Mr Rick Rothstein
thanks a lot for this great code
I tried your code on my pc as following :
I tried now 1000 rows ... calcuating the time elapsed for my code and yours.
As for my code it takes 1.7 seconds but your code takes 6.6 seconds !!
Here's the codes
Code:
Sub InsertEmptyRowKingTamo()
Dim LR As Long, I As Long, X As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
X = Int(LR / 4) + LR
For I = 5 To X Step 5
Cells(I, 1).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Next I
End Sub
Sub InsertEmptyRowRickRothstein()
Dim R As Long
For R = 5 To 5 * Cells(Rows.Count, "A").End(xlUp).Row Step 5
Rows(R).Insert
Next
End Sub
Sub CodeExecutionTime()
Dim xStartTime As Double
Dim xElapsedTime As Double
xStartTime = Timer()
Call InsertEmptyRowRickRothstein
xElapsedTime = Timer() - xStartTime
If xElapsedTime < 0# Then
xElapsedTime = xElapsedTime + 86400#
End If
MsgBox "Elasped Time : " & xElapsedTime
End Sub
Bookmarks