+ Reply to Thread
Results 1 to 3 of 3

worksheetfunction.vlookup gives #VALUE! error in VBA

  1. #1
    Registered User
    Join Date
    03-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2002
    Posts
    2

    worksheetfunction.vlookup gives #VALUE! error in VBA

    I've tried using the following (simplified) code to look up a date in a named range and return the result from the same row in the next column to the right. I can do this easily in the worksheet, but I can't write a VBA function to do it.
    Code:
    Please Login or Register  to view this content.
    Named range tab1:
    date result
    11/30/09 result 1
    12/02/09 result 2
    12/07/09 result 3

    Cell D11:
    =vlok()


    As an alternative, I've looked into using the Find method, but I need VLookup's ability to return a result from the prior row if it doesn't find an exact match. The example above should find an exact match because the lookup date is written into the code. If I can get this simplified code to work, I will send the lookup date to the function. That date might not be in the lookup table.

    Thanks for any help.
    Last edited by ses9; 11-29-2009 at 10:20 PM. Reason: forgot code tags

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: worksheetfunction.vlookup gives #VALUE! error in VBA

    Try using:

    Please Login or Register  to view this content.
    as your criteria...

  3. #3
    Registered User
    Join Date
    03-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2002
    Posts
    2

    Re: worksheetfunction.vlookup gives #VALUE! error in VBA

    Thank you! That solved the problem.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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