Hello,
The following macros will find the word "cancel" in column "U" and switch the formatting pattern for the entire row.
Instead, I need it to look in column "B" for a "0-" combination.
For example, Column "B" could have:
1134
2245
5555
0-1111
In the last instance where there is a 0-1111, I need it to recognize that and insert the same pattern that the code iterates below.
Sub DoCancelCells()
Dim Cell As Range
Dim RegExp As Object
Dim Rng As Range
Dim Wks As Worksheet
Set RegExp = CreateObject("VBScript.RegExp")
RegExp.Global = False
RegExp.IgnoreCase = True
RegExp.Pattern = "(^cancel[^0-9]+\b)|(\bcancel[^0-9]+\b)|(\bcancel[^0-9]$)"
For Each Wks In ActiveWorkbook.Worksheets
Set Rng = Wks.Range("U1", Wks.Cells(Rows.Count, "U").End(xlUp))
For Each Cell In Rng
If RegExp.Test(Cell) = True Then
Cell.EntireRow.Interior.Pattern = xlGray16
End If
Next Cell
Next Wks
Set RegExp = Nothing
End Sub
Thank you in advance for your help!!!!
Bookmarks