View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Brad[_21_] Brad[_21_] is offline
external usenet poster
 
Posts: 2
Default Using Vlookup in Worksheet_SelectionChange

Giday Everyone

I'm trying to use Vlookup in a Worksheet_SelectionChange event. It
works fine but only if the lookup table is on the same worksheet.

The same code in a module works with the table on any worksheet.


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
myanswer = Application.VLookup(Range("a1"), Range("table"), 2, False)
MsgBox (myanswer)
End Sub

Sub test()
myanswer = Application.VLookup(Range("a1"), Range("table"), 2, False)
MsgBox (myanswer)
End Sub

Have I found a limitation or is there an easy way around this?
Thanks in advance.

Regards

Brad
Brisbane Australia