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. |
All times are GMT +1. The time now is 05:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com