Deleting every other row
Hi,
Am Mon, 20 Jun 2016 18:52:58 +0200 schrieb Claus Busch:
Sub DeleteRows()
Dim LRow As Long, i As Long
LRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = LRow To 2 Step -1
If i Mod 2 = 0 Then
'To delete odd rows
'If i mod 2 = 1 then
Rows(i).Delete
End If
Next
End Sub
or define the row to start and try:
Sub Test()
Dim LRow As Long
Dim rngC As Range
Const rStart = 3 'First row to delete
LRow = Cells(Rows.Count, 1).End(xlUp).Row
For Each rngC In Range("A" & rStart & ":A" & LRow)
rngC.EntireRow.Delete
Next
End Sub
Regards
Claus B.
--
Windows10
Office 2016
|