Copy row and insert n times
Solved/Closed
Related:
- Yy macro ps5
- Copy each row x times excel - Best answers
- Excel duplicate rows n times - Best answers
- Saints row 2 cheats - Guide
- Insert key - Guide
- Insert check mark in word - Guide
- Insert the current date and time in cell a1 ✓ - Excel Forum
- How to insert photo in word for resume - Guide
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