Hi,
Want to create blank rows where I can later add Q1 to Q4 as entries in the data.
There are some 50-60 names in a column. Against every name, I want 4 blank rows to be inserted, so that I can paste Q1 to Q4 in those blank rows against each name.
Excel file is attached, this will help.
Thanks,
San.
Sub Insert4()
Dim lngLastRow As Long
Dim lngRow As Long
lngLastRow = Range("D1048576").End(xlUp).Row
For lngRow = lngLastRow To 6 Step -1
Cells(lngRow, "D").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Cells(lngRow, "D").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Cells(lngRow, "D").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Next
lngLastRow = Range("D1048576").End(xlUp).Row
For lngRow = 5 To lngLastRow Step 4
Cells(lngRow, "E") = "Q1"
Cells(lngRow + 1, "E") = "Q2"
Cells(lngRow + 2, "E") = "Q3"
Cells(lngRow + 3, "E") = "Q4"
If lngRow = lngLastRow Then
Exit For
End If
Next
End Sub
Your answer helped me create this code.
Open in new window