Deleting multiple rows (2 rows and leave 1)

Closed
dreamer_886 - 20 Oct 2011 à 16:18
venkat1926 Posts 1863 Registration date Sunday 14 June 2009 Status Contributor Last seen 7 August 2021 - 20 Oct 2011 à 22:23
Hello,

I need a REALLY QUICK reply. I'm working on a worksheet in excel that has hundreds of rows and I want to delete every 2 consecutive rows and leave the 3rd one. That is I want to delete rows 2&3, 5&6 etc. How can I do that? Thnx

Related:

1 response

venkat1926 Posts 1863 Registration date Sunday 14 June 2009 Status Contributor Last seen 7 August 2021 811
20 Oct 2011 à 22:23
try this macro

Sub test()
Dim j As Long, k As Long
j = Range("A1").End(xlDown).Row
For k = j To 1 Step -1
If k Mod 3 <> 1 Then Cells(k, 1).EntireRow.Delete
Next k
End Sub