find the index number for an array element
I meant a VBA array. Thanks, Tom.
"Tom Ogilvy" wrote:
Do you mean a VBA array or a range of cells on a worksheet
for a VBA array:
Dim v as Variant, i as Long, idx as Long
v = Range("A1:C200")
for i = 1 to 200
if v(i,1) = "dog" then
idx = i
exit for
end if
Next
if idx < 0 then
msgbox "found at index " & idx
else
msgbox "Not found"
end if
for a worksheet, use the match worksheet function.
--
Regards,
Tom Ogilvy
"Dick Minter" wrote in message
...
I want to lookup/find a specific value in an array and return that values
index number. In this case, the lookup list is the first column of 3
column
array. Suggestions?
DM
|