TS | Thomas
Posts: 1,318 +2
Hey. I'm trying to get a Macro to delete a row in Column A "if" it includes the number 9xxxxxx, e.g. 9000058. I also currently have it set to delete any rows where Column A is blank, or Column A is qqqqqqqq. These 2 work just fine, but I can't seem to get the 9xxxxxx deletion to work. Does anyone know how to get the Macro to look for wildcards? Here's the relevent section of the macro I'm using;
Dim rng As Range, cell As Range, del As Range
Set rng = Intersect(Range("A:A"), ActiveSheet.UsedRange)
For Each cell In rng
If (cell.Value) = "" _
Or (cell.Value) = "9******" _
Or (cell.Value) = "qqqqqqqq" Then
If del Is Nothing Then
Set del = cell
Else: Set del = Union(del, cell)
End If
End If
Next cell
On Error Resume Next
del.EntireRow.Delete
Dim rng As Range, cell As Range, del As Range
Set rng = Intersect(Range("A:A"), ActiveSheet.UsedRange)
For Each cell In rng
If (cell.Value) = "" _
Or (cell.Value) = "9******" _
Or (cell.Value) = "qqqqqqqq" Then
If del Is Nothing Then
Set del = cell
Else: Set del = Union(del, cell)
End If
End If
Next cell
On Error Resume Next
del.EntireRow.Delete