+ Reply to Thread
Results 1 to 3 of 3

if conditions meet a certain criteria...

  1. #1
    Registered User
    Join Date
    02-04-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    40

    if conditions meet a certain criteria...

    i have this code here, my problem is if the condition meet then run my macro 1


    Please Login or Register  to view this content.
    example is if(or(A1="pie",B1="american") then execute Macro 1
    else if not meet
    goto A2 and B2.
    until the end of the row.

    Thanks.

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,598

    Re: if conditions meet a certain criteria...

    Below is the code.Try it

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: if conditions meet a certain criteria...

    I am not sure what you are trying to achieve however I am not sure worksheet change event is what you want - it is essentially to detect a change in a worksheet and if condition is met then do something. For example
    Please Login or Register  to view this content.
    So if you enter "american" anywhere in range A1 to H1 then macro2 is run and if you enter "pie" anywhere from A1 to H1 in the worksheet then macro1 is called.
    What you want to do is check A1 and B1 for the words "american" or "pie" and if so run macro1 if not then check A2 and B2 and so on till you get to the end of the row. That is more suited to a module rather than a worksheet change event. For example
    Please Login or Register  to view this content.
    I would suggest you upload a sample workbook as your question is ambiguous - in your code you are looking for the word "each" however you go on to talk about different strings in the thread. I would suggest you are a little more specific and give a sample workbook showing how your workbook is set up and what you want to happen when certain conditions are met.
    Hope this helps.
    Anthony
    Pack my box with five dozen liquor jugs
    PS: Remember to mark your questions as Solved once you are satisfied. Please rate the answer(s) by selecting the Star in the lower left next to the Triangle. It is appreciated?

+ Reply to 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