Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA: how to refer to a Name Box value (cell name)

Status
Not open for further replies.

alglu

Programmer
Feb 24, 2009
1
Do anybody happen to know how the address of a cell that has been selected in a spreadsheet(the cell name that is displayed in the Name Box)can be known in VBA ?

For example,

Cells(Row, Column).Address =? "A5"
 
What a confused question!

What is displayed in the Name box is a Name if the Selection has a name, otherwise it's the address.

You can get the address easily with [blue][tt]selection.Address[/tt][/blue]. If the selection has a name, you can get it with [blue][tt]selection.Name.Name[/tt][/blue]; if not, you will get an error that you can trap.

What your example about Cells at the bottom is, I have no idea - the namebox reflects the selection, not an arbitrary Range, but if you want the Name of such a Range you can get it in the same way as you can for the selection.

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top