i have a worksheet with columns A-R and Column R has a number of orders. if column R has 5 orders, i need to duplicate that row 4 more times to have a total of 5 rows.
help me!!!! I'm a very beginning level with VB!!
i have a worksheet with columns A-R and Column R has a number of orders. if column R has 5 orders, i need to duplicate that row 4 more times to have a total of 5 rows.
help me!!!! I'm a very beginning level with VB!!
Attach an example workbook
Assuming your data starts in row 2, try:
Sub DuplicateRows()
Application.ScreenUpdating = False
Dim LastRow As Long, x As Long
LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
For x = LastRow To 2 Step -1
If Range("R" & x).Value > 1 Then
Rows(x).Copy
Range("A" & x + 1).EntireRow.Resize(Range("R" & x).Value - 1).Insert
End If
Next x
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Display More
Omg!!! Thank you soo very much, Mumps!!!! Thank you for taking time out of what you're doing to help!!!!
You are very welcome.
Don’t have an account yet? Register yourself now and be a part of our community!