BradleyS
Active Member
- Joined
- Oct 28, 2006
- Messages
- 351
- Office Version
- 2010
- Platform
- Windows
I have this code which works great finding a single string text value "9M0*" and if it exists it deletes the entire row.
i.e. If LCase(.Value) Like LCase("9M0*") Then .EntireRow.Delete
However, now I need to find multiple string values "9M0*", "9NU1*" to do the same task, but can't find a way to perform the string search on both or more than one value.
I tried the below, but it will not pick up the string unless it is an exact match, and I need to use a wild card
Select Case .Value
Case Is = "9M0*", "9NU1*": .EntireRow.Delete
End Select
Here is my current working code using :
i.e. If LCase(.Value) Like LCase("9M0*") Then .EntireRow.Delete
However, now I need to find multiple string values "9M0*", "9NU1*" to do the same task, but can't find a way to perform the string search on both or more than one value.
I tried the below, but it will not pick up the string unless it is an exact match, and I need to use a wild card
Select Case .Value
Case Is = "9M0*", "9NU1*": .EntireRow.Delete
End Select
Here is my current working code using :
Code:
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
'Set the first and last row to loop through
Firstrow = .UsedRange.Cells(1).Row
Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row
'Loop from Lastrow to Firstrow (bottom to top)
For Lrow = Lastrow To Firstrow Step -1
'Check the values in the C column
With .Cells(Lrow, "C")
If Not IsError(.Value) Then
If LCase(.Value) Like LCase("9M0*") Then .EntireRow.Delete
End If
End With
Next Lrow
End With