+ Reply to Thread
Results 1 to 6 of 6

VLookup Run-time Error 13 Type Mismatch

  1. #1
    Registered User
    Join Date
    12-15-2009
    Location
    Moros
    MS-Off Ver
    Excel 2003
    Posts
    7

    VLookup Run-time Error 13 Type Mismatch

    I have a textbox that allows users to enter data, once the length of data is 7 that textbox calls a function passing the contents of the textbox.

    All that seems to work fine.

    When I use VLookup to find the appropriate value it also seems to work until I try to show the returned value in a Msgbox.

    Here's the code

    Please Login or Register  to view this content.
    If I comment out the last line
    Please Login or Register  to view this content.
    I don't get an error but if I leave it in I get the Run-time Error 13 Type Mismatch error.

    Any ideas.

    Keill

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    12,879

    Re: VLookup Run-time Error 13 Type Mismatch

    I assume it can't find what it is looking for.

    Seems to work?
    Last edited by davesexcel; 12-17-2009 at 07:58 AM.

  3. #3
    Registered User
    Join Date
    12-15-2009
    Location
    Moros
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: VLookup Run-time Error 13 Type Mismatch

    Maybe. I figured it would throw an error if it couldn't find anything that's why I said it seems to work.

    The text should match - I have it working when I call VLookup from within a cell.

    Please Login or Register  to view this content.
    Where A11 contains the same value as I enter into the Textbox.

  4. #4
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: VLookup Run-time Error 13 Type Mismatch

    This is obvious when VLOOKUP does not find a value it returns #VALUE! error value.
    and that is not a string


    ... and maybe the A11 is the A11 on the active sheet and not the sheet you are referring to.
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    12,879

    Re: VLookup Run-time Error 13 Type Mismatch

    Attach a sample, we'll get this thing working for you.

  6. #6
    Registered User
    Join Date
    12-15-2009
    Location
    Moros
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: VLookup Run-time Error 13 Type Mismatch

    I'd love to attach a sample but it has a lot of private data in it. The machine it's on isn't permitted to be on the internet - it's just a stand alone machine. Which means I have to type the code out each time.

    I'll try to explain.
    Workbook1 AKA SourceDB.xls
    Sheet 1 - Contains staff info
    Column1(A) - Staff Number
    Column2(B) - Position Held
    Column3(C) - First Name
    Column4(D) - Last Name

    There are more columns but I don't need them at this point.

    Workbook2 AKA userInput.xls
    Sheet1 - A test sheet I made which has 3 Columns
    Column1(A) - Staff Number - to be entered manually
    Column2(B) - First Name - evaluated from
    Please Login or Register  to view this content.
    where 11 is the corresponding row.
    Column3(C) - Last Name
    Please Login or Register  to view this content.
    This works perfectly.

    Workbook2 AKA userInput.xls
    Sheet3 - This sheet contains a textbox
    The textbox has a method attached that calls the findStaffByStaffID Sub located in Module1 of Workbook2.
    I know the value is getting to findStaffByStaffID because the first MsgBox shows it.
    The problem is with VLookup either not finding the corresponding value or not searching in the right place.

+ 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