Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to obtain Cell Name

Hi,

My question is the following.

After naming a range (in this case, a single cell) in a Worksheet, I need to
obtain the name of the ActiveCell after doing a "double-click". I have no
problem with the "general" programing for making an event happen in the
active cell with the double click as a trigger, but instead of getting the
name, I get the reference.

The code I use:

ActiveCell.Name

I get, for example: Sheet1!C4R1, instead of the cell name, that's what I need.

If anyone could give me a hand with this will be of great help.

Many thanks.

Rgds!!!
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default How to obtain Cell Name

Hi Nicholas,

Try:

Target.Value = ActiveCell.Name.Name


---
Regards,
Norman



"Nicholas!" wrote in message
...
Hi,

My question is the following.

After naming a range (in this case, a single cell) in a Worksheet, I need
to
obtain the name of the ActiveCell after doing a "double-click". I have no
problem with the "general" programing for making an event happen in the
active cell with the double click as a trigger, but instead of getting the
name, I get the reference.

The code I use:

ActiveCell.Name

I get, for example: Sheet1!C4R1, instead of the cell name, that's what I
need.

If anyone could give me a hand with this will be of great help.

Many thanks.

Rgds!!!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default How to obtain Cell Name

Building on William's answer, you could get incorrect results if there are
ranges in several sheets referring to the same address. I am sure this can
be improved upon, but this appears to pick up the difference and handle
sheet specific names such as Sheet1!MyRange.

Sub Test()
Dim strName As String
strName = GetRangeName(ActiveCell)
If strName < "" Then
MsgBox strName
End If
End Sub

Public Function GetRangeName(rngTest As Range) As String
Dim nm As Name
For Each nm In ThisWorkbook.Names
If nm.RefersTo = rngTest.Name Then
GetRangeName = nm.Name
Exit Function
End If
Next nm
End Function

Robin Hammond
www.enhanceddatasystems.com

"William" wrote in message
...
Hi

Doubtless there are better solutions but you can try

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Dim nm As Name
For Each nm In ThisWorkbook.Names
If Range(nm).Address = Target.Address Then MsgBox nm.Name
Next nm
End Sub

--
XL2002
Regards

William



"Nicholas!" wrote in message
...
| Hi,
|
| My question is the following.
|
| After naming a range (in this case, a single cell) in a Worksheet, I
need
to
| obtain the name of the ActiveCell after doing a "double-click". I have
no
| problem with the "general" programing for making an event happen in the
| active cell with the double click as a trigger, but instead of getting
the
| name, I get the reference.
|
| The code I use:
|
| ActiveCell.Name
|
| I get, for example: Sheet1!C4R1, instead of the cell name, that's what I
need.
|
| If anyone could give me a hand with this will be of great help.
|
| Many thanks.
|
| Rgds!!!




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Obtain row number of active cell Jive Excel Worksheet Functions 4 January 8th 08 01:06 PM
Obtain last four characters from a cell. mohd21uk via OfficeKB.com Excel Discussion (Misc queries) 3 May 17th 06 02:13 PM
How do I obtain the address of a cell using the vlookup function? Spock Excel Worksheet Functions 2 May 16th 05 06:35 PM
how can one obtain the current selected cell value Susan Hayes Excel Programming 3 December 14th 04 10:31 AM
how to obtain the result of the formula in another cell youngman Excel Programming 3 August 10th 03 03:27 PM


All times are GMT +1. The time now is 12:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"