Deleting alternae rows

Solved/Closed
abthak - Feb 14, 2010 at 03:12 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Feb 14, 2010 at 08:41 AM
Hello,
I want to delete every alternate rows from my work sheet. I tried recording macro, but it only deletes a particular row as shown in macro below (Rows 4:4). Can we do something to it so that i can delete alternate rows with no hassles.. Since I am not trained as a programmer, I will appreciate if anybody can help me out in doing so..
below is the macro i recorded

Sub Macro3()
'
' Macro3 Macro
'
' Keyboard Shortcut: Ctrl+q
'
Rows("4:4").Select
Selection.Delete Shift:=xlUp
End Sub

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Feb 14, 2010 at 07:50 AM
Sub deleteAlternateRow()

Dim startAtRow, endAtRow, rowCounter As Long

startAtRow = 2
endAtRow = 100


For rowCounter = startAtRow To endAtRow
    Rows(rowCounter).Select
    Selection.Delete Shift:=xlUp
Next
End Sub
2
Wow!!!!....
It has worked.
Thanks a lot. :)
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766 > abthak
Feb 14, 2010 at 08:41 AM
Glad it worked out for you. I have just mailed you the bill :p~~ kidding
0