Question : Application.WorksheetFunct<wbr />ion.Match Validation

Hi,

I'm using Application.WorksheetFunction.Match function in my Excel VBA code. Of course there are occasions where there is no match. The value of this is a parameter of another function - how can I validate this fucntion so it doesn't throw an application error

Answer : Application.WorksheetFunct<wbr />ion.Match Validation

You might think of some code like:

    If IsError(Application.Match("YourValue", Range("C:C"), 0)) Then
      Msgbox "No match found"
   Else
     tmpVal = Application.Match("YourValue", Range("C:C"), 0)
      msgbox "Match found on: " & tmpVal
    End If


In this example it checks if an error is risen when there is no match.
regards,
Jeroen
Random Solutions  
 
programming4us programming4us