K
ker_01
I googled, but didn't find any good hits that addressed this.
I have a 2-D array that is populated by combining unique records from two
different workbooks. I then have to use a value in the first column
(MyArray(X,1)) and use that to find a matching value in a different 2-D
array, pulled in from a different workbook ("RawArray"); once I know what
"row" the match is in, I will pull a value from the 5th "column" of RawArray.
I tried using application.match, but it keeps returning an error 2042. I've
manually confirmed that the value exists (correcting for one being text, the
other being a number), but it still isn't getting a match. I'm starting to
suspect that it is my syntax, or somehow related to how I load the "RawArray"
[in the code below] by using RawArray = mywrksht.Range("A2:AK5000").Value,
since it returns the values as RawArray(rows, columns) but I'm not clear on
whether that is really the problem, or how to fix it.
I appreciate any help,
Keith
Dataset 1 (expressed as a worksheet layout)
Header1 (Header2 Header 3, etc.)
ID101
ID102
ID103
Dataset2
Header1 H2 H3 H4 H5 (H6, etc)
ID412 abc
ID921 def
ID101 ghi
So basically, I am cycling the first list, and for each one pulling in the
corresponding value under header5, in this first case, ID101-> ghi
Here is the actual code (sorry for the linewrap, I am using the MS web
interface, ugh):
For CheckC = 2 To LastPro
'changing the numeric value to a string, because it is a string in the
other array
TempID = ProArray(CheckC, 1) & ""
'try to find the matching value
TempIDRow = Application.Match(TempID, RawArray, False)
If IsError(TempIDRow) Then MsgBox "There is still a problem"
Next
I have a 2-D array that is populated by combining unique records from two
different workbooks. I then have to use a value in the first column
(MyArray(X,1)) and use that to find a matching value in a different 2-D
array, pulled in from a different workbook ("RawArray"); once I know what
"row" the match is in, I will pull a value from the 5th "column" of RawArray.
I tried using application.match, but it keeps returning an error 2042. I've
manually confirmed that the value exists (correcting for one being text, the
other being a number), but it still isn't getting a match. I'm starting to
suspect that it is my syntax, or somehow related to how I load the "RawArray"
[in the code below] by using RawArray = mywrksht.Range("A2:AK5000").Value,
since it returns the values as RawArray(rows, columns) but I'm not clear on
whether that is really the problem, or how to fix it.
I appreciate any help,
Keith
Dataset 1 (expressed as a worksheet layout)
Header1 (Header2 Header 3, etc.)
ID101
ID102
ID103
Dataset2
Header1 H2 H3 H4 H5 (H6, etc)
ID412 abc
ID921 def
ID101 ghi
So basically, I am cycling the first list, and for each one pulling in the
corresponding value under header5, in this first case, ID101-> ghi
Here is the actual code (sorry for the linewrap, I am using the MS web
interface, ugh):
For CheckC = 2 To LastPro
'changing the numeric value to a string, because it is a string in the
other array
TempID = ProArray(CheckC, 1) & ""
'try to find the matching value
TempIDRow = Application.Match(TempID, RawArray, False)
If IsError(TempIDRow) Then MsgBox "There is still a problem"
Next