Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That means the value wasn't found. error 2042 is the same as #N/A
cvErr(xlErrNA) from the immediate window: ? cvErr(xlErrNA) Error 2042 In your sample code, you redim preserve your arrays twice, but you don't change anything the second time, so not sure why you are doing it again there (not that it should make a difference). for instance, in my example I would normally do Dim res as Variant .. .. .. res = Application.VLookup(12, v, 5, False) if iserror(res) then msgbox "12 was not found" Else MsgBox "Value returned is " & res End If The only reason I used Redim in my example is that I declared my array as dynamic dim v() as Variant I could have skipped the Redim if I did Dim v(1 To 20, 1 To 5) as Variant so there is nothing particularly pertinent with regard to using Redim in the example. Most of the example was spend building up a dummy array so I could demo that Vlookup worked. Anyway, a common problem is that a textbox produces a string value. Even if I entered 123 in the textbox, it would return "123" (a string with 3 characters that happend to be numerals). However, if my data contains 123 stored as a number, then "123" < 123 and vlookup would fail. This doesn't appear to be your problem because you say you are searching for "tie4ch", which is clearly text. Since you are looking for an exact match, any possibility the search term might have a space or two appended on the end "tie4ch " instead of "tie4ch"? -- Regards, Tom Ogilvy "Dean Hinson" wrote in message ... Tom, I figured out the type mismatch but now I am getting an error 2042 from the VLOOKUP. What is that? "Dean Hinson" wrote: Hello, I have a multidimensional array that is sorted on the first column and was trying to use the VLOOKUP to search for particular entries. VLOOKUP doesn't seem to reconize arrays. Has anybody been able to incorporate a faster search other than scanning the array by looping through iterative times? Any help is appreciated. Dean. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
array search | Excel Worksheet Functions | |||
Search for reference in an array | Excel Discussion (Misc queries) | |||
search array | Excel Worksheet Functions | |||
SEARCH EXCEL ARRAY FOR NON-VOIDS AND ENTER INTO ANOTHER ARRAY, | Excel Programming | |||
Search an array | Excel Programming |