Sub Sales_Summary_Macro()
Dim strMake, strModel, strCount As String
Dim makeLoc, modelLoc, countLoc As Integer
strMake = Application.InputBox(\"Make\")
This is not a direct answer to the OP, but people (like me) may find this question helpful when trying to TRAP an error with vba Match
. Typically I would use this to test if a value exists in an array.
It's quite maddening when using Application.Worksheetfunction.Match
and being unable to capture a True
with IsError
when a value doesn't exist. Even the WorksheetFunction
error handlers (iserr
, isNA
, etc) will not capture this as True
and instead throws the VBA error of 1004 Unable to get the Match Property.
This is resolved by using Application.Match
instead of Application.WorksheetFunction.Match
. This is most counterintuitive as Match
doesn't appear in the intellisense after typing Application.
nor does Application.Match(
display prompts for what fields to enter.
Meanwhile using Application.WorksheetFunction.Match
does auto-populate with prompts which understandably can inspire users to take this approach and then be confused why they can't successfully trap an error.