+ Reply to Thread
Results 1 to 8 of 8

Macro to find cell based on one of three different values.

  1. #1
    Registered User
    Join Date
    09-19-2013
    Location
    NY, NY
    MS-Off Ver
    Excel 2010
    Posts
    31

    Question Macro to find cell based on one of three different values.

    Hello everyone.
    I'm trying to write a macro that will go to a cell in a specific column based on one of three values.
    I have a column (L) with a formula in each cell, starting on L3, which compares values of six cells, in pairs on the same row.
    The number of rows changes from time to time, growing or shrinking.

    =IF(E402=M402,IF(F402=N402,IF(G402=O402,"","W"),"H"),"M")

    The macro I want should find any one of these three values, W, H, or M, and go to that cell, regardless of which it finds first.
    Basically, I want it to go to the next "error", since these values reflect differences in the comparisons.

    I tried the following code, but it only works for one of the criteria; I don't want to write three separate macros
    and I don't know how to make an "or" statement... "find W or H or M and go there"

    Please Login or Register  to view this content.
    Thank you, in advance, for any and all help, ideas, suggestions, etc. provided.

    Cheers,
    Alphonse

    Moderators note: code tags added for you - this time
    Last edited by FDibbins; 09-19-2013 at 05:59 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Macro to find cell based on one of three different values.

    Hi and welcome to the forum

    Please take a(nother?) look at rule 3 concerning code tags
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Macro to find cell based on one of three different values.

    See if this helps

    Please Login or Register  to view this content.
    Thanks

  4. #4
    Registered User
    Join Date
    09-19-2013
    Location
    NY, NY
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Macro to find cell based on one of three different values.

    Hi Fred, thanks for answering. I tried your code, but it just goes round and round. In the meantime, (gotta love bosses just about now) a couple of changes were made to the spreadsheet, but the only thing that got affected for my purpose is that now the column became "I" instead of "L". My questions: Should it now look like this, changing the 3 L's to I's in the For statement? Does it pop out of the loop (ignore the Next statement) once it finds a match?

    Please Login or Register  to view this content.
    Note to moderator: Thanks for the code tags, and I hope I did them correctly... :-/
    Cheers
    Last edited by Alphonse68; 09-19-2013 at 08:28 PM.

  5. #5
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Macro to find cell based on one of three different values.

    Hello,

    I totally forgot the exit when a value is found.

    Here is the final

    Please Login or Register  to view this content.
    Thanks

  6. #6
    Registered User
    Join Date
    09-19-2013
    Location
    NY, NY
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Macro to find cell based on one of three different values.

    Sir, I need to thank you. Works like a charm. Now, regarless of how many mistakes any one line has, it goes right back to it to point out the next. No more scrolling looking for the next instance. Thank you so very much.
    Now, being a noob (overstating the obvious), I imagine that I click on Add Reputation, right?
    Take care, and
    CHEERS!!!

  7. #7
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Macro to find cell based on one of three different values.

    if you think i helped yes

    thanks a lot

  8. #8
    Registered User
    Join Date
    09-19-2013
    Location
    NY, NY
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Macro to find cell based on one of three different values.

    Last question: is there a way to make this post show as SOLVED?

    Found it. Thanks again!!

+ 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. Macro to find all specific values in column and replace adjacent cell values
    By dblock02 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-23-2013, 06:03 AM
  2. Need help making a macro to copy range of values based on cell values.
    By zolton in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-23-2013, 08:58 AM
  3. [SOLVED] Tweaking Macro to match and find two cell values not just one
    By Zawoooo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-16-2012, 06:51 PM
  4. Macro to find sheet name based on info in a cell
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-20-2012, 11:07 PM
  5. Macro - auto populate the values based on previous cell values
    By Avinash Kumar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-05-2009, 02:02 AM

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