get current cell address

mwesterman

New Member
Joined
Nov 15, 2005
Messages
2
I need to be able to return the current cell address (row and column) as shown in the "refernce area".
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Using code this will work, but I would suggest you use the formula option, if it works, but the code will dynamically update the cell value. The formula won't without a recalculation.

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("C20") = ActiveCell.Address
End Sub

HTH
Cal
 
Upvote 0
Going from what you specify in your other post (which should have been a reply in this thread instead of a new thread):
In a particular cell (c20, for instance), I want that cell to always display the address (row and column) of the current cell that I have clicked on. Thus, cell c20 would display whatever location is shown in the upper left hand reference area.

Use:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

[C20] = Target.Address
End Sub

Right-click the sheet tab you want to use it on, select "View Code," and paste the code in the VBE window that is opened.
 
Upvote 0
Cbrine said:
Using code this will work, but I would suggest you use the formula option, if it works, but the code will dynamically update the cell value. The formula won't without a recalculation.

Actually, that particular formula won't work at all for the question at hand. Well, it *will* work for returning the address of the cell it is entered in (which is what the OP seemed to be asking at first), but not for the address of the cell that is selected (as the OP specified in the post I linked to this thread).
 
Upvote 0
VP,
I actually posted to the dead link originally, and figured this was a duplicate post, now I realize the other post had more information.

Cal
 
Upvote 0

Forum statistics

Threads
1,224,903
Messages
6,181,651
Members
453,059
Latest member
jkevin

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