+ Reply to Thread
Results 1 to 5 of 5

How to error trap a vlookup that returns an error or #N/A

  1. #1
    Forum Contributor
    Join Date
    12-03-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    107

    How to error trap a vlookup that returns an error or #N/A

    so i simplified my code to make it as an example. my macro goes like this:

    a user clicks an activecell, runs a macro and the macro runs a vlookup on the activecell, if a result is found, it is given in a msgbox.

    My problem is if the user puts the active cell on a data that will return an error (or #N/A in excel formula terms) the macro runs into a type mismatch error. I just want to trap it so that if the active cell is on a data that returns an error and the macro is run, it will show a msgbox that basically says "Invalid Code" or "Item not found"


    here is my example:

    Please Login or Register  to view this content.

    On error goto badentry

    doesnt work, i dont know why.

  2. #2
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: How to error trap a vlookup that returns an error or #N/A

    try
    Please Login or Register  to view this content.
    Please use [CODE]-TAGS
    When your problem is solved mark the thread SOLVED
    If an answer has helped you please click to give reputation
    Read the FORUM RULES

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to error trap a vlookup that returns an error or #N/A

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to error trap a vlookup that returns an error or #N/A

    Include
    Please Login or Register  to view this content.
    in your formula.

  5. #5
    Forum Contributor
    Join Date
    06-04-2013
    Location
    Moscow
    MS-Off Ver
    Office 365
    Posts
    100

    Re: How to error trap a vlookup that returns an error or #N/A

    Please Login or Register  to view this content.

+ 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