+ Reply to Thread
Results 1 to 5 of 5

VBA Code - IfError Help

  1. #1
    Registered User
    Join Date
    05-11-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    28

    VBA Code - IfError Help

    Hi,

    I have a vlookup formula in my vba code, and it basically goes through a array checking all accounts. But right now, it crashes if an account in present in the vlookup.

    I am basically looking to run the vba and if it finds a #NA, instead of shutting code, it should keep running and saving all the vlookup values in an array that gave the error.

    For example,
    Vlookup runs to find account number 123, then it goes to the next account number 124 but its not in the list, instead of crashing I want the another array save this account number and go to the next account number.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA Code - IfError Help

    Put the result of the Vlookup in a variant variable, then use IsError to check that variable before doing anything else.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    05-11-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    28

    Re: VBA Code - IfError Help

    Hi,

    I get an error at RES=Application.Vlooklip ...... Run-Time Error 13, type mismatch

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA Code - IfError Help

    How did you declare Res?

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,540

    Re: VBA Code - IfError Help

    Change the "lip" to "Up" in Vlooklip

+ 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] IFERROR autopopulate code isn't bringing the right text from list tab to calendar tab
    By nkicroft in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-05-2014, 02:43 PM
  2. [SOLVED] IF ISERROR instead of IFERROR macro code
    By turist in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-20-2014, 09:41 AM
  3. xlfn.IFERROR or IFERROR don't work in Excel 98-2003
    By dj_danu01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-26-2013, 02:53 AM
  4. comparision between two excel sheet using VBA Code for Index/match/and/iferror formula
    By gaurangaero in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-28-2012, 10:08 AM
  5. [SOLVED] Writing code for a function to combine iferror and vlookup
    By tommyko in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-31-2012, 05:39 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