Macro to delete an entire row with cells missing a specific chartacter

A

asf

Hey Harald,

This is the script I am using to remove "IS"

Sub Findanddelete_IS()
Dim rng As Range
Dim what As String
what = "IS"
Do
Set rng = ActiveSheet.UsedRange.Find(what)
If rng Is Nothing Then
Exit Do
Else
Rows(rng.Row).Delete
End If
Loop
End Sub



So...my programming experience is a tiny bit limited, not sure how t
delete anything missing the IS as opposed to containing the IS.
understand in theory but my knowledge of syntax is the limiter.
 
D

Dave Peterson

If I were doing it manually, I'd apply data|filter|autofilter to that range.

Then filter on that column using custom.
Show the cells you want to delete
(Does not contain maybe very useful!)

Select those visible cells (avoiding the header)
rightclick|delete
 
H

Harald Staff

Ok, I was imagining another approach <g>. Sorry. See if this does it (on a
copy !!!):

Sub test()
Dim R As Long
For R = Cells(15000, 2).End(xlUp).Row To 2 Step -1
If InStr(Cells(R, 2).Value, "@") = 0 Then Rows(R).Delete
Next
End Sub

The 2 in the code means column number 2; B column.

HTH. Best wishes Harald
 
Top