Thread: Offset
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Offset

One way:

Dim rFound As Range
Set rFound = Range("B:B").Find( _
What:="GHI", _
LookIn:=xlValues, _
LookAt:=xlWhole, _
MatchCase:=False)
If Not rFound Is Nothing Then _
MsgBox rFound.Offset(0, -1)

BTW - your XL formula would be a bit more efficient as

=INDEX(A1:A4,MATCH("GHI",B1:B4,FALSE))



In article
<Syed.Haider.Ali.1uj46h_1125324326.0393@excelfor um-nospam.com,
Syed Haider Ali
<Syed.Haider.Ali.1uj46h_1125324326.0393@excelfor um-nospam.com wrote:

Hi Freinds,

I have a Table with 2 Fields

A B
1000 ABC
2000 DEF
3000 GHI
4000 JKL


I want to Find "GHI" in col B and if found then shows the corresponding
value of Col "A" i,e 3000.

In simple the Formula is

@offset(b1,match("GHI,b1:b4,0)-1,-1)

I neet the code in VBA-Excel

Thanks

Syed Haider Ali