Hello,
I need my macros to search for the word "Cancel" in columns "T". Once found, I need the macros to make that entire row a certain pattern ( .Pattern = xlGray16)
There will be other wording in these cells that contain "Cancel" or "Cancelled".
A compile error keeps occurring. It says "Ambiguous name detected: FormatCell"..
I'm confused with it..... any suggestions?
Thank you in advance for your help.Sub DoCancelCells() Dim strSearchString As String Dim wksSheet As Worksheet Dim rngSearchRange As Range Dim intSearchCount As Integer Application.ScreenUpdating = False 'String to search for. strSearchString = "cancel" intSearchCount = 0 For Each wksSheet In ActiveWorkbook.Sheets wksSheet.Select Set rngSearchRange = Range("T1:T" & Range("T" & Rows.Count).End(xlUp).Row) For Each cell In rngSearchRange If cell.Value = strSearchString Then intSearchCount = intSearchCount + 1 Call FormatCell(cell.Address) End If Next cell Set rngSearchRange = Nothing Next wksSheet Application.ScreenUpdating = True End Sub Sub FormatCell(strCellAddress As String) With Range(strCellAddress).EntireRow.Interior .Pattern = xlGray16 .PatternColorIndex = xlAutomatic .ColorIndex = xlAutomatic .TintAndShade = 0 .PatternTintAndShade = 0 End With
Bookmarks