+ Reply to Thread
Results 1 to 3 of 3

Search for value and exit macro if found

  1. #1
    Valued Forum Contributor
    Join Date
    03-23-2008
    Location
    Tennessee
    MS-Off Ver
    Office 2007
    Posts
    706

    Search for value and exit macro if found

    Good day, Gurus.

    I have a macro that copies data from the active workbook to another workbook. If the data is already in the other workbook, however, I want to give a message, "This PO Number is Already in the Tracking Log", and then exit.

    The value I want to search will always be found in cell M2 of the active workbook, and I really only need to search Column M of the other workbook to see if the value is found.

    Here is what I have so far. The area with the extra line breaks is where I need to add the code to search and either give the message and exit or continue to run the macro:
    Please Login or Register  to view this content.
    Thanks in advance for any help you can offer.
    Last edited by hutch@edge.net; 01-08-2014 at 09:38 PM.

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Search for value and exit macro if found

    Try

    Please Login or Register  to view this content.
    多么想要告诉你 我好喜欢你

  3. #3
    Valued Forum Contributor
    Join Date
    03-23-2008
    Location
    Tennessee
    MS-Off Ver
    Office 2007
    Posts
    706

    Re: Search for value and exit macro if found

    Perfect, millz. Thanks!

+ 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. [SOLVED] How to Stop & Exit Sub if cell value > 1 was found
    By tuongtu3 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-20-2013, 01:41 AM
  2. Excel Macro Search if not found debug
    By zit1343 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-14-2012, 11:29 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 exit a loop once the value is found in the range
    By Suety in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-28-2010, 01:30 PM
  5. Exit Sub if file/path not found
    By EMoe in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-16-2006, 06:55 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