nbarttelot
02-19-2015, 06:17 AM
I have data in an unknown number of rows
I need to copy each row and paste it the number of times stated in in a corresponding cell.
I have got this to work for an individual row but cannot get it to loop down the rows until it reaches a blank cell.
This is the code I have to copy one row A2 contains the number of times to be repeated and should also be what is checked for being blank.
Sub Copy_Paste_2()
Dim I As Long
For I = 1 To Range("A2")
Range("B2:F2").Copy
Range("I" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Next I
End Sub
This is my failed attempt at looping
Sub FindEmptyCell_1()
Range("A2").Select
Do
For I = 1 To Range("A2")
Range("B2:F2").Copy
Range("I" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Next I
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell.Value)
End Sub
I really appreciate any help/advice given, am about to repeat the some macro 50 times and then link them together :/
I need to copy each row and paste it the number of times stated in in a corresponding cell.
I have got this to work for an individual row but cannot get it to loop down the rows until it reaches a blank cell.
This is the code I have to copy one row A2 contains the number of times to be repeated and should also be what is checked for being blank.
Sub Copy_Paste_2()
Dim I As Long
For I = 1 To Range("A2")
Range("B2:F2").Copy
Range("I" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Next I
End Sub
This is my failed attempt at looping
Sub FindEmptyCell_1()
Range("A2").Select
Do
For I = 1 To Range("A2")
Range("B2:F2").Copy
Range("I" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Next I
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell.Value)
End Sub
I really appreciate any help/advice given, am about to repeat the some macro 50 times and then link them together :/