+ Reply to Thread
Results 1 to 5 of 5

VLookup VBA error trapping

  1. #1
    Forum Contributor
    Join Date
    07-29-2008
    Location
    New York
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    145

    VLookup VBA error trapping

    Can anyone tell me how to modify this formula to trap errors? I tried wrapping it in IsError (code) Then...but it doesn't work. I don't want a function.

    Please Login or Register  to view this content.
    I'm trying to modify this formula :
    Please Login or Register  to view this content.
    The column search changes every month based on the information in column F.

    Thanks,
    Xrull
    Last edited by Xrull; 01-07-2009 at 12:36 AM.

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

    Not sure what you mean by not wanting a function, but one way to get around this is to use COUNTIF (even though it IS a function) to get a count of the item that is the lookup value. If the result is 0, then there is nothing there, so don't do the lookup. Otherwise go ahead with the lookup.

    rylo

  3. #3
    Forum Contributor
    Join Date
    07-29-2008
    Location
    New York
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    145
    rylo,
    I don't need a UDF. I need a Sub procedure. If you run the code, it leaves no formulas in the cells. I'm trying to avoid leaving formulas in the cells because the formulas take up a lot of memory, and the sheet takes too long to calculate when I run the formulas for sheets over 40000 rows.
    Thanks for helping me clarify the type solution I require.
    Xrull

  4. #4
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    hi

    You may need to do some fine tuning but try this:

    Please Login or Register  to view this content.
    I have used the LastRow technique to minimise the referenced range which may help with calculation speed.


    hth
    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

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

    another way
    Please Login or Register  to view this content.
    rylo

+ 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