Delete alternate rows
Hi Tim,
Here is one that prompts you for the range of rows.
Sub DelAlternateRows()
'Deletes every other row in a defined range of rows
'Examples: start row = 10, end row = 20, deletes rows 11, 13, 15, 17, 19
' start row = 1, end row = 10, deletes rows 2, 4, 6, 8, 10
' start row = 0, end row = 10, deletes rows 1, 3, 5, 7, 9
' Prompts for start and end rows.
Dim Rows2Delete As Range
Dim StartRow As Long
Dim EndRow As Long
Dim iRow As Long
StartRow = Application.InputBox("Enter Start Row", "Delete Alternate Rows", _
1, Type:=1)
With ActiveSheet.UsedRange
EndRow = .Row + .Rows.Count - 1
End With
EndRow = Application.InputBox("Enter End Row", "Delete Alternate Rows", _
EndRow, Type:=1)
iRow = StartRow + 1
Set Rows2Delete = Rows(iRow)
iRow = iRow + 2
Do While iRow <= EndRow
Set Rows2Delete = Union(Rows2Delete, Rows(iRow))
iRow = iRow + 2
Loop
Rows2Delete.Delete
End Sub
Damon