Closed Thread
Results 1 to 2 of 2

Need Desperate help on my loop. Keep getting same error....

Hybrid View

  1. #1
    Registered User
    Join Date
    08-31-2009
    Location
    washington, dc
    MS-Off Ver
    Excel 2003
    Posts
    55

    Need Desperate help on my loop. Keep getting same error....

    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?

    
    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
    Thank you in advance for your help.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Need Desperate help on my loop. Keep getting same error....

    Please take a few minutes to re-read the forum rules, and then start a new thread with an appropriate title.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1