F
Frank Kabel
Hi
reason for this error is:
you start in row 1 but you're trying to move the cursor one row up (row
0).
Also you should start in the last row moving up
You may try the following code instead:
Sub delete_rows()
Dim RowNdx As Long
Dim LastRow As Long
Application.ScreenUpdating = False
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).row
For RowNdx = LastRow To 1 Step -1
with Cells(RowNdx, "A")
if .value<>"A" and .value <>"B" and .value <>"C" then
Rows(RowNdx).Delete
End If
end with
Next RowNdx
Application.ScreenUpdating = True
End Sub
--
Regards
Frank Kabel
Frankfurt, Germany
is not A, B of E. (groups) If the value is anything else then delete
the row and move onto the next one
use the help to fix the problem but as usual it was no help.
reason for this error is:
you start in row 1 but you're trying to move the cursor one row up (row
0).
Also you should start in the last row moving up
You may try the following code instead:
Sub delete_rows()
Dim RowNdx As Long
Dim LastRow As Long
Application.ScreenUpdating = False
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).row
For RowNdx = LastRow To 1 Step -1
with Cells(RowNdx, "A")
if .value<>"A" and .value <>"B" and .value <>"C" then
Rows(RowNdx).Delete
End If
end with
Next RowNdx
Application.ScreenUpdating = True
End Sub
--
Regards
Frank Kabel
Frankfurt, Germany
another task. I want it to delete the row only if the value in Column Bdhbyrne said:I am trying (badly) to modify the code below which i was using for
is not A, B of E. (groups) If the value is anything else then delete
the row and move onto the next one
error "application defined, or object defined error". I was trying toWhen the Code gets to Set c = cf.Offset(-1, 0) etc it creates an
use the help to fix the problem but as usual it was no help.