Results 1 to 21 of 21

Match function is malfunctining if variable is used as arg1

Threaded View

  1. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Match function is malfunctining if variable is used as arg1

    I'll give it a try but I'll tell you what might be the problem - the array is being populated from a combobox/listbox so it's populated with strings, not numbers.

    That would be a problem if the column you were trying to find a match in had numeric data.

    Hard to tell if that's the case because, well, there's no data on any of the sheets apart from a header row on 'Input'.

    Another problem is that a match just isn't being found, perhaps because there's no data.

    If that's what's happening here's how you can deal with it.
    Dim MatB As Variant ' allows MatB to be an error value
    
    ' other code
    
        Set MatB = Application.Match(choice(y), Columns("B:B"), 0) ' Application.Match should prevent a runtime error
    
        If IsError(MatB) Then
            MsgBox choice(y) & " not found."
        End If
    Last edited by Norie; 09-05-2013 at 09:45 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] MATCH function with a variable as lookup_value?
    By mccalle in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-23-2013, 07:37 AM
  2. Adding a variable to index & match function using VBA
    By prestopr in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-07-2013, 05:48 PM
  3. Replies: 2
    Last Post: 11-05-2011, 03:26 PM
  4. Specifying Arguments in Run ([Macro], [arg1],[arg2]...)
    By Kaigi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-09-2010, 06:35 PM
  5. Using Match function output as a variable
    By iii in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-28-2009, 06:01 PM

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