Sub Keeptop3()
Dim lastrow As Integer
lastrow = ActiveSheet.UsedRange.Rows.Count
For i = 4 To lastrow
Rows(i).Delete
Next i
End Sub
I have used the lastrow to find the count of rows. I need only the top 3 rows. I am getting them plus the 5th row.
When I make it i=4, I get the top 2 rows and the 4th row.
What is wrong with my code?