Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Return the name of a range in a sheet formula

Try the following VBA function in a standard code module. It will return the
name of the specified cell, if it is named. If the cell is not named, it
returns a #VALUE error. If you pass in a range of more than one cell, it
returns a #REF error.

Function NameOfCell(Rng As Range) As Variant
Dim S As String
On Error Resume Next
If Rng.Cells.Count 1 Then
NameOfCell = CVErr(xlErrRef)
Else
S = Rng.Name.Name
If Err.Number < 0 Then
NameOfCell = CVErr(xlErrValue)
Else
NameOfCell = S
End If
End If

End Function


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)



"XP" wrote in message
...
In Excel 2003, is it possible to enter a formula in a sheet that returns
the
NAME of a named range. In this case, the named range is a single cell.

Is it also possible to return the name given to a cell within that cell,
for
example, if B5 was named L50A enter some formula in B5 to return "L50A"?

Thanks for the assist.



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
How can I use a formula to return the first number in a range? Husker87 Excel Worksheet Functions 14 June 16th 09 03:26 AM
Any formula to return the most frequent bin range? hankach Excel Discussion (Misc queries) 15 April 6th 08 08:18 PM
formula to return a $ amount for a range of % michelledean via OfficeKB.com New Users to Excel 2 August 12th 07 08:10 AM
Formula - Analyse range, return unique value S Davis Excel Worksheet Functions 4 February 20th 07 11:16 PM
Input box doesn't return sheet name with range quartz[_2_] Excel Programming 1 August 24th 04 04:29 PM


All times are GMT +1. The time now is 03:24 PM.

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

About Us

"It's about Microsoft Excel"