+ Reply to Thread
Results 1 to 5 of 5

Application.Match failing to match numeric values

  1. #1
    Registered User
    Join Date
    12-02-2009
    Location
    Sheffield, England
    MS-Off Ver
    Office 365
    Posts
    22

    Application.Match failing to match numeric values

    Hi All
    I have a macro to compare two worksheets and report any differences.
    The macro will search for a particular value in each row, and check to see if it exists on the other sheet.
    I'm using application.match as follows:
    varSResult = Application.Match(strSearchText, rSearchRange, 0)
    The match works fine for any text values, but all numeric values throw an error (i.e. no match), even though they exist in both sheets.
    I'm sure this is a formatting thing but what am I doing wrong? I want to search all values as strings, even if they're purely numeric.
    Do I need to use another function or is there a way to get match to do what I want?
    TIA
    Si

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,522

    Re: Application.Match failing to match numeric values

    First, if you dimension the variable "strSearchText" As String, then change its type to Variant,
    Then add one line
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-02-2009
    Location
    Sheffield, England
    MS-Off Ver
    Office 365
    Posts
    22

    Re: Application.Match failing to match numeric values

    No change unfortunately with this:
    Please Login or Register  to view this content.
    Anything where strITSN is purely numeric fails. Using .find works, but I need to know the row the match took place on.

  4. #4
    Registered User
    Join Date
    12-02-2009
    Location
    Sheffield, England
    MS-Off Ver
    Office 365
    Posts
    22

    Re: Application.Match failing to match numeric values

    .... and fixed. Declaring strITSN as a variant rather than a string fixed it.
    I suspect I misunderstood your answer - apologies if so.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,522

    Re: Application.Match failing to match numeric values

    Yep, that's what I suggested.
    Last edited by jindon; 07-11-2021 at 08:21 AM.

+ 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] If Then to Set Variable Values Issue with Application Match
    By kgreave1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-04-2015, 03:38 PM
  2. [SOLVED] Application.Match help. Find a match if first 4 numbers are the same. Asterisk not working
    By thelisa in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-24-2013, 08:01 AM
  3. INDEX MATCH MATCH working great and then failing on me.
    By HeikEve in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-25-2013, 01:40 PM
  4. [SOLVED] Test IF Two Numeric Values Match (from two separate Dynamic Ranges)
    By Biff in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 07:05 AM
  5. [SOLVED] Test IF Two Numeric Values Match (from two separate Dynamic Ranges)
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  6. Test IF Two Numeric Values Match (from two separate Dynamic Ranges)
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-13-2005, 08:05 PM

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