+ Reply to Thread
Results 1 to 4 of 4

ON error fetches only first occurance

  1. #1
    Registered User
    Join Date
    02-09-2021
    Location
    Dortmund
    MS-Off Ver
    2013
    Posts
    4

    ON error fetches only first occurance

    Hi,

    in the below small script the "Vlookup" function throws an error message in case no matching value is found. This is correct and expected and should be handled by the "on Error".
    But it works only on the first run.
    On the second time the "On Error" does not fetch the problem anymore and the code breaks with error 1004 "Unable to get Vlookup property of worksheetfunction class"

    Any idea what I need to do to make the "on Error" statement work every time?
    I tried "Err.Clear" to start with a "blank sheet" on every new loop, but that did not change anything.

    Please Login or Register  to view this content.
    Thanks a lot for any hint - or maybe completely different solution to handle the failing vlookup.

    regards Ralf

  2. #2
    Registered User
    Join Date
    04-19-2021
    Location
    Dublin, Ireland
    MS-Off Ver
    O365, Win10 and Mac
    Posts
    47

    Re: ON error fetches only first occurance

    You need to resume to clear the error

    Please Login or Register  to view this content.

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,804

    Re: ON error fetches only first occurance

    Alternatively, use Application.Vlookup which returns an error value, not a runtime error:

    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  4. #4
    Registered User
    Join Date
    02-09-2021
    Location
    Dortmund
    MS-Off Ver
    2013
    Posts
    4

    Re: ON error fetches only first occurance

    Two relevant answers both including working solutions. Thanks a lot!

+ 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. I'm looking for the last occurance
    By khank in forum Excel General
    Replies: 2
    Last Post: 01-18-2022, 02:27 PM
  2. Error message when linking files random occurance
    By kimmie3383 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-22-2021, 02:05 PM
  3. [SOLVED] Last 10 occurance or available occurance average
    By thilag in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-02-2015, 11:50 PM
  4. Replies: 5
    Last Post: 03-04-2014, 12:43 PM
  5. [SOLVED] 1st occurance of value
    By quibilty in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-13-2013, 11:08 PM
  6. Pausing SQL refresh while it fetches data
    By Static Cat in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-22-2013, 04:32 AM
  7. [SOLVED] HYPERLINK FETCHES WRONG FILE--SOMETIMES
    By Terry in forum Excel General
    Replies: 0
    Last Post: 07-14-2006, 03:30 PM

Tags for this Thread

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