horizonflame
Board Regular
- Joined
- Sep 27, 2018
- Messages
- 184
- Office Version
- 2013
Hi All,
I am looking to delete rows containing the letter "S" in column C, and containing "cost", "ref" or "spare" anywhere in the string. I think I have the code sorted from research but can you help make it ignore case sensitivity?
Thanks
I am looking to delete rows containing the letter "S" in column C, and containing "cost", "ref" or "spare" anywhere in the string. I think I have the code sorted from research but can you help make it ignore case sensitivity?
Thanks
Code:
Sub test()
Application.ScreenUpdating = False
Dim i&
i = Range("D" & Rows.Count).End(xlUp).Row
While i <> 1
With Cells(i, 4)
If (.value Like "*cost*" _
Or .value Like "*ref*" _
Or .value Like "*spare") _
Then
Rows(i).Delete
End If
End With
i = i - 1
Wend
Dim i&
i = Range("C" & Rows.Count).End(xlUp).Row
While i <> 1
With Cells(i, 3)
If .value Like "*S*" _
Then
Rows(i).Delete
End If
End With
i = i - 1
Wend
Application.ScreenUpdating = True