B
Brad
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
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