+ Reply to Thread
Results 1 to 4 of 4

Match Function in VBA finding strings

  1. #1
    Registered User
    Join Date
    06-24-2015
    Location
    United States
    MS-Off Ver
    2010
    Posts
    21

    Match Function in VBA finding strings

    Hello! I am wondering why this code is throwing back an error??? I am trying to match to numbers that are like: 2014-01, 2015-15, 2017-24 etc...

    The code gets the index with regular numbers, but it does not run with the 45-1 example I made. Please help!

    Thanks!

    Please Login or Register  to view this content.
    Last edited by beric7; 06-13-2016 at 10:48 AM. Reason: Added Code Tags

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: Match Function in VBA finding strings

    If I change the given line to

    Given = "45-1"

    and run the code, with the string value in A3, then the result in D10 is 3.

    So it appears that the code works for me.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Match Function in VBA finding strings

    So it appears that the code works for me.
    Same here, even with "2014-01" etc. Of course Given has to be exact match of one of the values in column A since you use 0 in Match-function.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Registered User
    Join Date
    06-24-2015
    Location
    United States
    MS-Off Ver
    2010
    Posts
    21

    Re: Match Function in VBA finding strings

    Thanks you! This cleared things up!

+ 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. Match different long strings with an array of short, summarizing strings
    By FKemps in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-24-2015, 12:55 AM
  2. Match function in VBA, for finding a cell
    By poorworker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-06-2015, 02:19 PM
  3. Multiple Criteria Index/Match Function in VBA Looking Up Dates/Strings/Numbers
    By nadstradamus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-21-2014, 12:35 PM
  4. Replies: 9
    Last Post: 12-21-2012, 04:18 AM
  5. [SOLVED] loop to match if shorter strings appears in longer strings
    By mcdermott2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-19-2012, 08:07 PM
  6. [SOLVED] Offset function with nested match function not finding host ss.
    By MKunert in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-21-2006, 06:50 PM
  7. Finding two variables on the same row to match function
    By Werner in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-11-2005, 04:37 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