That's an interesting problem. Here's a solution that works but might need some modification to make it more dynamic if the number of rows changes. Basically, you would need to step backwards in counts of 4 and delete the three rows in between. Sub deleteTest() Dim wb As Workbook Set wb = ThisWorkbook Dim ws As Worksheet Set ws = wb.Sheets("Sheet1") For i = 2000 To 4 Step -4 ws.Rows(i).Delete ws.Rows(i - 1).Delete ws.Rows(i - 2).Delete Next i End Sub
Thanks
thanks
if I have 2000 rows and I want to keep cells numbers 1,5,9,13....at and delete the other rows how can I do that?
That's an interesting problem. Here's a solution that works but might need some modification to make it more dynamic if the number of rows changes. Basically, you would need to step backwards in counts of 4 and delete the three rows in between.
Sub deleteTest()
Dim wb As Workbook
Set wb = ThisWorkbook
Dim ws As Worksheet
Set ws = wb.Sheets("Sheet1")
For i = 2000 To 4 Step -4
ws.Rows(i).Delete
ws.Rows(i - 1).Delete
ws.Rows(i - 2).Delete
Next i
End Sub