+ Reply to Thread
Results 1 to 3 of 3

Getting ‘Type mismatch’ error using Vlookup in VBA code

  1. #1
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173

    Getting ‘Type mismatch’ error using Vlookup in VBA code

    I keep getting a Run-time error ‘13’: Type mismatch when running the following code. The error only occurs at this line:
    Please Login or Register  to view this content.
    The code is looking for a value in the wkbData sheet. If the value is not found, it returns “”. The code runs fine if the lookup value is in the wkbData sheet. The error pops up for the first instance for which the lookup value is not found on this line. I don’t get the error for the two proceeding lines, so I can’t figure out why it won’t work. Thanks in advance for any comments.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Getting ‘Type mismatch’ error using Vlookup in VBA code

    In the first two lines you check for errors on the inserted data (LN, resp. FN). In the 3rd line you insert LN as well as FN, but only check for errors on LN.
    I can't verify without data of course, but FN being in error may cause your problem.
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  3. #3
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173

    Re: Getting ‘Type mismatch’ error using Vlookup in VBA code

    I ended up checking for an error first within an if statement. Working fine now.
    Please Login or Register  to view this content.

+ 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