View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default select a cell following vlookup


Dim res As Variant, res1 as Variant
Dim table As Range
Dim myVal As Range
Set myVal = Range("LastQTR")
Set table = Range("table")

'res = Application.HLookup(myVal, table, 2, False)
res1 = Application.Match(myVal,Table.Rows(1),False)
If IsError(res1) Then
MsgBox "not found"
Else
Table(1).Cells(2,res1).select
End If

--
Regards,
Tom Ogilvy

"caroline" wrote:

I am trying to find a value and then select the cell found.
the following does not work because of "range(res).select"
any idea? Thanks
(I am not using the Find function because the range "table" includes
functions)

Dim res As Variant
Dim table As Range
Dim myVal As Range
Set myVal = Range("LastQTR")
Set table = Range("table")

res = Application.HLookup(myVal, table, 2, False)
If IsError(res) Then
MsgBox "not found"
Else
range(res).select

End If
--
caroline