jawaharprm
Member
Hi All, can help me with a macro to duplicate rows based on specific cell value in column A?
For example, i have data in 10 rows, then I need the line to be duplicated so it appears 7 times. per number so total row will be 70.
Enclosed file for reference
worked code pasted below
>>> You asked to edit this <<<
>>> use code - tags <<<
For example, i have data in 10 rows, then I need the line to be duplicated so it appears 7 times. per number so total row will be 70.
Enclosed file for reference
worked code pasted below
>>> You asked to edit this <<<
>>> use code - tags <<<
Code:
sub duplicate()
Dim lr1, lr2 As Long
Dim i As Long
Dim y As Workbook
Set y = ThisWorkbook
With y.Sheets("MARC")
lr2 = Range("A5").Value
lr2 = Range("A" & Rows.Count).End(xlUp).Row
For i = lr2 To 8 Step -1
Range("A" & i).Copy
Range("A" & i).Resize(lr2 - 1).Insert shift:=xlShiftDown
Next i
Application.CutCopyMode = False
End With
Attachments
-
11.3 KB Views: 9
Last edited by a moderator: