Solved

# MS Excel VBA match function for an array

Posted on 2011-09-08
267 Views
I am trying to build an array to generate a report.  The data for the report is stored in various arrays, but when I use the MATCH function I am presented with "unable to get the match property of the WorksheetFunction class.  The arrays in the code below are defined as follows:
ReportArray(200,8) and ProdArray(200,2) - the common field in both is ID.

Below is the code generating the error message:
For x = 1 To RptRows
ID = ReportArray(x, 1)
ID_Fnd = WorksheetFunction.Match(ID, ProdArray, 0)   ' (error is generated here)
ReportArray(x, 7) = ProdArray(GPN_Fnd, 2)
Next x
0
1 Comment

LVL 81

Accepted Solution

zorvek (Kevin Jones) earned 500 total points
Change:

ID_Fnd = WorksheetFunction.Match(ID, ProdArray, 0)   ' (error is generated here)

To:

ID_Fnd = Application.Match(ID, ProdArray, 0)   ' (error is generated here)

Kevin
0

## Featured Post

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

#### Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!