+ Reply to Thread
Results 1 to 2 of 2

Need macro to search for key word in column and then run another macro if found

Hybrid View

  1. #1
    Registered User
    Join Date
    02-25-2015
    Location
    Dallas, Texas
    MS-Off Ver
    2010
    Posts
    1

    Need macro to search for key word in column and then run another macro if found

    Hi. I need a macro that will search for the word "PAID" in cells Y4:Y42 and if the key word is present run another macro (which will take certain information such as name and address and enter it into a tracker file). If the key word is not present, then no action is taken. I need this task to repeat for each sheet of the workbook (up to 44 sheets in the largest workbook). I'm not experienced at VBA and don't know how to assign variables properly. I'm thinking something alone these line would work, if I knew how to assign variable: [code] Sheets("TrimA1").Select
    If TrimA1.CountIf("Y4:Y42", "LATE") > 0 Then
    Run Macro12
    End If
    Sheets("TrimA2").Select [code]
    ... and start over again.

    Forgive any breaches of etiquette. This is my first time to post on a forum.

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Need macro to search for key word in column and then run another macro if found

    Hi Atorado,

    Welcome to the forum!!

    See how this goes:

    Option Explicit
    Sub Macro1()
    
        Dim wsSheet As Worksheet
        
        Application.ScreenUpdating = False
        
        For Each wsSheet In ThisWorkbook.Sheets
    
            If wsSheet.Application.WorksheetFunction.CountIf(wsSheet.Range(("Y4:Y42")), "LATE") > 0 Then 'COUNTIF function is not case sensitive
                Call Macro12
            End If
            
        Next wsSheet
        
        Application.ScreenUpdating = True
    
    End Sub
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 10-17-2014, 07:26 AM
  2. Need help to write a macro to search for a word or number in a column
    By mhill10 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-26-2014, 02:31 AM
  3. [SOLVED] Macro ignores search code when 1 of the 2 search parameters is not found
    By BrodyNoochie in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2012, 05:21 PM
  4. How to search for a word in a column and have entire row opaque once word is found
    By copleyr in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-04-2009, 07:11 PM
  5. Macro to Search column and if found, copy a cell within the worksheet
    By SKooT1027 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-16-2008, 01:12 PM

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