Using a Cell Address as part of a Lookup formula

stirlingmw

Board Regular
Joined
Feb 18, 2013
Messages
75
Morning All
I am trying to put together a "Help" button that describes what data should in added to certain cells.

What I have is a worksheet "Help" that in column A has a list of all of the cell addresses from my "Data" worksheet that have an input function. I.e. cell $K6$ = data input of Date and therefore Column A in Help has $K6$ and Column B has an explanation "Input a Date".

I can get the lookup function to work if an using a Text string to locate the cell address in Column A, but I want to be able to use ActiveCell.Address to locate the required text. So if I selected cell $K$6 in the "data" worksheet I want the lookup to search column A for the text $K$6 and return what is in Column B.

If I substitute ACell for the text "$K$6" it works.

VBA Code:
Sub LookUpHelp()
    Dim sRes As String
    Dim ACell As String
    
    ACell = ActiveCell.address
    sRes = Application.VLookup(ACell, Worksheets("Help").Range("A1:B10"), 2)
    
    MsgBox sRes
    
End Sub

Any ideas?

TIA

Steve
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
VBA is trying to match the value in cell K6

Amend one line
VBA Code:
ACell = "" & ActiveCell.Address & ""
 
Upvote 0

Forum statistics

Threads
1,215,256
Messages
6,123,903
Members
449,132
Latest member
Rosie14

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top