Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 12
Default Show field or range name in a cell

Hi. I'm trying to keep all my naming conventions documented, so I've set up a sheet in my work book listing all the cell or range names I've created.

Is there any way to have a cell show the assigned name of another cell? Can this formula be put directly in the cell

example =name($B$1)

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Show field or range name in a cell

Not with anything built into excel.

But you could create a userdefined function that could return that name.

Option Explicit
Function myName(rng As Range) As String
Application.Volatile True
On Error Resume Next
myName = rng.Name.Name
On Error GoTo 0
End Function

This kind of function could be one calculation behind. If the Name changes (or
gets created), then you'll want to force a recalculation before you believe the
results.

Application.volatile true
means that excel will recalculate each of these formulas each time excel
recalculates. You may notice a slowdown in your workbook.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Short course:

Open your workbook.
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Now go back to excel.
Into a test cell and type:
=myName(a1)

==========
Remember that ranges/cells can have more than one name and that a single cell
could be part of lots of ranges. So you may not get the name you expect.

If this is to help you develop a workbook (checking purposes), then don't use
this.

Get a copy of Jan Karel Pieterse's (with Charles Williams and Matthew Henson)
Name Manager:

You can find it at:
NameManager.Zip from http://www.oaltd.co.uk/mvp

If you use names, this will make you're life easier.



Michael Excel Dude wrote:

Hi. I'm trying to keep all my naming conventions documented, so I've
set up a sheet in my work book listing all the cell or range names I've
created.

Is there any way to have a cell show the assigned name of another cell?
Can this formula be put directly in the cell

example =name($B$1)

Thanks

--
Michael Excel Dude


--

Dave Peterson
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
Cell Reference with Range Name SCSC Excel Worksheet Functions 2 March 23rd 06 11:32 PM
How do I total range of cells that have checks in checkboxes? instructorjml Excel Discussion (Misc queries) 2 March 23rd 06 11:56 AM
How can I show all field data in a pivot table, instead of blank Alastair Scott Excel Discussion (Misc queries) 3 August 17th 05 07:08 PM
macro help thephoenix12 Excel Discussion (Misc queries) 4 July 15th 05 05:57 PM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM


All times are GMT +1. The time now is 04:25 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"