I have found this code from another thread on this forum for deleting the row that contains a cell (in column B) that begins with a specific letter. I would like to perform the same task for numbers. Simply replacing the C* with 2* has not worked.
Any help is greatly appreciated.
Sub DeleteRows()
Dim i As Long
i = Range("B" & Rows.Count).End(xlUp).Row
With Range("B1:B" & i)
If Application.WorksheetFunction.CountIf(Columns(2), "C*") > 0 Then
.AutoFilter field:=1, Criteria1:="C*"
.Offset(1).Resize(.Rows.Count - 1, 1).EntireRow.Delete
.AutoFilter
End If
End With
End Sub
Any help is greatly appreciated.
Sub DeleteRows()
Dim i As Long
i = Range("B" & Rows.Count).End(xlUp).Row
With Range("B1:B" & i)
If Application.WorksheetFunction.CountIf(Columns(2), "C*") > 0 Then
.AutoFilter field:=1, Criteria1:="C*"
.Offset(1).Resize(.Rows.Count - 1, 1).EntireRow.Delete
.AutoFilter
End If
End With
End Sub