Macro for deleting everyother six rows starting with row 7.

Closed
Joy - Apr 9, 2015 at 10:20 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Apr 9, 2015 at 11:07 AM
Hello,
I am trying to use the macro function to delete six rows, skip six row, then delete six and so on. Can you help me?


Related:

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 552
Apr 9, 2015 at 11:07 AM
Hi Joy,

Here is your macro code:
Sub RunMe()
Dim x, y As Integer

'Delete rows 7:13
x = 7
y = 13

Do
    Rows(x & ":" & y).Delete
    'Skip 1 row
    x = x + 1
    y = y + 1
'Stop deleting rows when 93 (100-7) rows are skipped.
Loop Until x = 100

End Sub


Best regards,
Trowa
0