Copy row and insert n times
Solved/Closed
Related:
- Excel duplicate rows n times
- Yy macro ps5 - Best answers
- Copy each row x times excel - Best answers
- You have guessed too many times ✓ - WhatsApp Forum
- Excel marksheet - Guide
- Excel free download - Download - Spreadsheets
- Number to words in excel - Guide
- Dash becomes date on excel ✓ - Office Software Forum
22 responses
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Sep 9, 2009 at 10:38 PM
Sep 9, 2009 at 10:38 PM
It is a bother to modify a already created macro even it it is one's own.
I have given you another macro similar to one given before.
I have given you another macro similar to one given before.
Sub test() Dim rng As Range, c As Range Dim rng1 As Range, c1 As Range Dim dest As Range, j As Integer, k As Integer Worksheets("sheet2").Cells.Clear With Worksheets("sheet1") Set rng = Range(.Range("A2"), .Range("A2").End(xlDown)) j = WorksheetFunction.CountA(.Rows("1:1")) 'msgbox j For Each c In rng Set rng1 = Range(c.Offset(0, 1), .Cells(c.Row, Columns.Count).End(xlToLeft)) 'msgbox rng1.Address For Each c1 In rng1 Set dest = Worksheets("sheet2").Cells(Rows.Count, "a").End(xlUp).Offset(1, 0) 'msgbox dest.Address If c1 = "" Then GoTo line1 'dest.Offset(0, 0) = c 'dest.Offset(0, 1) = .Cells(1, c1.Column) 'dest.Offset(0, 2) = c1 dest = c dest.Offset(0, 1) = c1 dest.Offset(0, 2) = .Cells(1, c1.Column) line1: Next c1 Next c End With With Worksheets("sheet2").Columns("c:c") .NumberFormat = "dd-mmm-yy" End With End Sub
Sep 12, 2015 at 12:48 PM