Thread: Match Command
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Match Command

You can use =vlookup() with data that isn't sorted. Just make sure you specify
False as the 4th argument.

=vlookup(a1,sheet2!a:d,3,false)

In code...

dim res as variant
dim myLookupRange as range
dim myCell as range

set mycell = worksheets("sheet1").range("a1")
set mylookuprange = worksheets("sheet2").range("A:D")

res = application.vlookup(mycell.value, mylookuprange,3,false)

if iserror(res) then
'not found
else
msgbox res
end if

====
I'm not sure what the 3rd column of the row in a textbox1 means.


Syed Haider Ali wrote:

Dear Friends,

I need code for to find the record through macth command instead of
vlookup command. It is because the data is not in a sort order, and i
don't want to change the sorting order of the original data.

When the data found then select the 3rd col of the row in a textbox1.

Thanks in advance

Syed Haider Ali

--
Syed Haider Ali
------------------------------------------------------------------------
Syed Haider Ali's Profile: http://www.excelforum.com/member.php...o&userid=21994
View this thread: http://www.excelforum.com/showthread...hreadid=397469


--

Dave Peterson