Copy a row and paste it down 119 times
Closed
ybiancheng
venkat1926
- Posts
- 3
- Registration date
- Monday September 22, 2014
- Status
- Member
- Last seen
- February 6, 2015
venkat1926
- Posts
- 1864
- Registration date
- Sunday June 14, 2009
- Status
- Contributor
- Last seen
- August 7, 2021
Related:
- Copy a row and paste it down 119 times
- Vba copy last row and paste below - Guide
- Inserted row should paste in 7times in next sheet based on the date ✓ - Forum - Excel
- Vba find next empty row and paste - Forum - Excel
- Vba to copy and paste a range multiple times based on cell value ✓ - Forum - Excel
- Copy/paste a range 'n' times. ✓ - Forum - Excel
2 replies
venkat1926
Sep 23, 2014 at 03:44 AM
- Posts
- 1864
- Registration date
- Sunday June 14, 2009
- Status
- Contributor
- Last seen
- August 7, 2021
Sep 23, 2014 at 03:44 AM
data is like this col A to D(copy sheet 1 to shee2 also to preserve original data)
A1 B1 C1 D1
A2 B2 C2 D2
A3 B3 C3 D3
for experiment in the macro I have used m=10 that is repeated 10 time. you can change this code as you like.
macro is
A1 B1 C1 D1
A2 B2 C2 D2
A3 B3 C3 D3
for experiment in the macro I have used m=10 that is repeated 10 time. you can change this code as you like.
macro is
Sub test()
Application.ScreenUpdating = False
Dim j As Long, k As Long, m As Long
m = 10
Worksheets("sheet1").Activate
j = Range("A1").End(xlDown).Row
For k = j To 1 Step -1
Cells(k, 1).EntireRow.Copy
Range(Cells(k, 1), Cells(k + m, 1)).EntireRow.Insert
Next k
Application.ScreenUpdating = True
Application.CutCopyMode = False
End Sub
venkat1926
Sep 29, 2014 at 01:19 AM
- Posts
- 1864
- Registration date
- Sunday June 14, 2009
- Status
- Contributor
- Last seen
- August 7, 2021
Sep 29, 2014 at 01:19 AM
adjust m value to get what you want
as entire row is copied I expect it does not matter the cells in the first column of row is blank.
as entire row is copied I expect it does not matter the cells in the first column of row is blank.
Sep 28, 2014 at 11:46 PM
I tried the codes, and there are two issues that I hope you can help me with further:
1) Each row was copied 12 time down (including the original data), rather than 10 times. I wonder why that is the case?
2) I realized that for some of my data, the first cell is actually blank (but the remaining ones have data). Those rows need to be copied as well, but are ignoed by the macro. I was wondering if there is any way to have the macro include those rows as well. So for instance:
A1 B1 C1 D1
A2 B2 C2 D2
B3 C3 D3
The macro would ingore the 3rd row. Can the codes be amended to include the 3 row as well?
Thanks a lot!