+ Reply to Thread
Results 1 to 4 of 4

Mismatch with match function

  1. #1
    Forum Contributor
    Join Date
    02-12-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2016
    Posts
    270

    Mismatch with match function

    Hi All

    I am trying to write a match function in command button to look up certain values
    my values are in range a

    Prod code
    10060
    10061
    10062
    10063
    10064

    on the same sheet i am trying to put a command button trying to match
    user input with prod code and find the relative position of it and just msgbox the number
    but it through mismatch, should this code also use index function if so how ?

    Also wanted to know difference between application.match and application.worksheetfunction.match



    Please Login or Register  to view this content.
    Never confuse a single defeat to the final defeat.

  2. #2
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: Mismatch with match function

    use WorksheetFunction.Match
    Click on the star if you think I helped you

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

    Re: Mismatch with match function

    You are getting Type Mismatch error because you have declared x as string while values in col. A are numbers.
    Declare x as long like below
    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
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,017

    Re: Mismatch with match function

    Application.Match will return an error value that you can test with IsError if the lookup value is not found; Application.Worksheetfunction.Match will raise a runtime error if the value is not found. Other than that, they behave the same way.

    If your mismatch error occurs on the Msgbox line, your lookup value wasn't found and y contains an error value.
    Everyone who confuses correlation and causation ends up dead.

+ 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. Excel 2007 : Match & MisMatch Formula for 3 criteria
    By xcruc1at3r in forum Excel General
    Replies: 0
    Last Post: 02-08-2012, 04:22 PM
  2. Match Function Type Mismatch
    By officialhopsof in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 06-14-2011, 02:58 AM
  3. Match Function OK in worksheet but type mismatch in VBA
    By Matt1234au in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-03-2008, 07:53 PM
  4. Type Mismatch Error on Find Closest Match
    By carsto in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-12-2007, 11:07 AM
  5. Type Mismatch - Match function
    By T De Villiers in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-31-2006, 10:48 AM

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