+ Reply to Thread
Results 1 to 6 of 6

Running a search macro - Need an alternative "if item not found."

  1. #1
    Registered User
    Join Date
    12-18-2012
    Location
    Spanish Lookout, Belize
    MS-Off Ver
    Excel 2007
    Posts
    3

    Running a search macro - Need an alternative "if item not found."

    Hi!
    I'm creating a workbook with one sheet of data, another sheet to insert a list of item numbers of which data needs to be extracted, and a third sheet which is supposed to neatly display the data. I'm using Excel's search option to find the specific data row in the "Data" sheet, but if it searches for an item that is not stored in the data sheet, I want it to paste the missing item number into an alternate location for later review. If someone can give me the code or refer me to this kind of coding material I'll be grateful. Attached is the file and following is my code as well.

    Example:
    Let's say in the "List" sheet, I insert ten item numbers. One of them may be missing in the "Data" sheet if not recently updated. When this code runs, the Run-time error '91' comes up at the missing item number. At this point I want the missing item number pasted into the "Print" sheet in column G for later review, and then continue the loop through the rest of the items.

    Any help will be greatly appreciated!
    Orlando

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Running a search macro - Need an alternative "if item not found."

    Hi

    Here goes.

    Please Login or Register  to view this content.
    rylo

  3. #3
    Registered User
    Join Date
    12-18-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Running a search macro - Need an alternative "if item not found."

    Hi Orlando,

    Try this code - works for me.

    Regards, J450n

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-18-2012
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2010
    Posts
    47

    Re: Running a search macro - Need an alternative "if item not found."

    Sorry Orlando,

    I modified the above slightly to get it to work but pasted the pre-modified code!

    Try this:

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    11-15-2008
    Location
    ph
    MS-Off Ver
    2007/2010/2016
    Posts
    479

    Re: Running a search macro - Need an alternative "if item not found."

    Hi -

    also try;
    Please Login or Register  to view this content.
    Regards,
    Event

  6. #6
    Registered User
    Join Date
    12-18-2012
    Location
    Spanish Lookout, Belize
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Running a search macro - Need an alternative "if item not found."

    Thanks Rylo! Just what I needed!

+ 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