Hi Team,
I want to delete all row where Cell contain Word
Macro is throwing error at
. these rows unable to delete.
if I replace these words with N/A and run a Loop it works. after autofilter also it works.
How to skip #N/A Line and delete other Row.
I want to delete it via loop only. How to achieve this task. Thank.
Below is table.
Thanks
mg
I want to delete all row where Cell contain Word
Rich (BB code):
Remove.
Macro is throwing error at
Rich (BB code):
#N/A
if I replace these words with N/A and run a Loop it works. after autofilter also it works.
How to skip #N/A Line and delete other Row.
I want to delete it via loop only. How to achieve this task. Thank.
VBA Code:
Sub Delete_Loop()
Dim i As Long
For i = Range("a" & Rows.Count).End(xlUp).Row To 2 Step -1
If InStr(1, Cells(i, 1).Value, "Remove", vbTextCompare) > 0 Then '[B] getting error for [B] #N/A , as[/B] type mismatch .[/B]
Cells(i, 1).EntireRow.Delete
End If
Next i
End Sub
Below is table.
Book1 | |||
---|---|---|---|
A | |||
1 | Data | ||
2 | #N/A | ||
3 | #N/A | ||
4 | Remove | ||
5 | Remove | ||
6 | Finished | ||
7 | Finished | ||
8 | #N/A | ||
9 | Finished | ||
10 | Finished | ||
11 | #N/A | ||
12 | Finished | ||
13 | Remove | ||
14 | Finished | ||
15 | Finished | ||
16 | #N/A | ||
17 | Finished | ||
18 | Finished | ||
Sheet1 |
Thanks
mg