+ Reply to Thread
Results 1 to 8 of 8

Help with vlookup code - returns error if no match

  1. #1
    Registered User
    Join Date
    08-04-2014
    Location
    Stockholm
    MS-Off Ver
    2013
    Posts
    58

    Help with vlookup code - returns error if no match

    Hello,

    I use this code for a vlookup macro. When it doesnt find the value it gives me the value "#Value".
    How can I change this so it leaves the cell blank if there is no match?

    Thanks!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Help with vlookup code - returns error if no match

    Did you try removing this line?

    Please Login or Register  to view this content.

  3. #3
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,647

    Re: Help with vlookup code - returns error if no match

    Try something like this.....
    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  4. #4
    Registered User
    Join Date
    08-04-2014
    Location
    Stockholm
    MS-Off Ver
    2013
    Posts
    58

    Re: Help with vlookup code - returns error if no match

    Both of those soloutions give me an error when I run the code

  5. #5
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,647

    Re: Help with vlookup code - returns error if no match

    Which line gets highlighted when you click on Debug after getting an error msg?

  6. #6
    Registered User
    Join Date
    08-04-2014
    Location
    Stockholm
    MS-Off Ver
    2013
    Posts
    58

    Re: Help with vlookup code - returns error if no match

    If myCell.Offset(, 1).Value = "" Then

  7. #7
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,647

    Re: Help with vlookup code - returns error if no match

    There is nothing wrong in the line of code If myCell.Offset(, 1).Value = "" Then. What error message you get? Better you upload the sample workbook with the code applied.

  8. #8
    Registered User
    Join Date
    08-04-2014
    Location
    Stockholm
    MS-Off Ver
    2013
    Posts
    58

    Re: Help with vlookup code - returns error if no match

    I found the problem. Thanks!

+ 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] Vlookup to Pivot Table, using Match function, returns error if can't find match value
    By AndrewHowarth in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-16-2015, 12:10 AM
  2. [SOLVED] MATCH/INDEX Formula Returns an Error Instead of 0
    By livifivil in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-07-2013, 04:18 PM
  3. vlookup returns the same value above a certain first match
    By lrpainting in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-04-2012, 04:34 PM
  4. VLOOKUP returns a incorrect match
    By nander in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 09-05-2007, 04:12 PM
  5. Vlookup only returns 1st match!
    By Botir in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-17-2007, 04:58 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