Try this VBA code

Sub add5rows()
'VBA code to add 5 empty rows into each of number of rows

Dim tmpRow As Integer
Dim lstRow As Integer
Dim allRows As Integer

Dim i As Integer

tmpRow = 6 'the second row of all rows you want to add empty rows to
allRows = 9 'put any number of rows here as long as you computer can handle it! In your case is 2000 instead of 9
lstRow = (allRows - 1) * 6 + tmpRow

Do Until tmpRow = lstRow

For i = 1 To 5
Rows(tmpRow & ":" & tmpRow).Select
Selection.Insert Shift:=xlDown
tmpRow = tmpRow + 1
Next i

tmpRow = tmpRow + 1

Loop
End Sub

請您先登陸,再發跟帖!