LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default Create a TOC for ALL names in workbook?

It appears that you may have plans of including additional material
from the indexed sheets as well, so ...

You might also take a look at
Build Table of Contents, similar listings, working with Hyperlinks
http://www.mvps.org/dmcritchie/excel/buildtoc.htm
and
Build TOC Another Approach
http://www.mvps.org/dmcritchie/excel/excel.htm

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"pQp" wrote in message ...
Great! this does it. Thanks for all the added info too. I'll keep the whole
thing for future use, but I was able to simplify it for my particular
purpose - (the workbooks I need this for, contain only local names and not
much chance I'll need error handling (thankfully at this stage))
PS. I'm using 97 so I couldn't make use of the download you suggested
(2000+) but dank maat anyway.
PQP




"keepitcool" wrote in message
...

In most cases following should work

Sub NamesTOC()
Dim i%, n%, s$
On Error Resume Next
Worksheets("toc").Activate
n = 10
Cells(n, 2).CurrentRegion.Clear
For i = 1 To Names.Count
With Names(i)
'check if it is a range not a formula/constant
s = .RefersToRange.Address
If Err = 0 Then
n = n + 1
Cells.Hyperlinks.Add Cells(n, 2), "", .Name, , .Name
End If
End With
Next
End Sub

The names collection is rather more complex then you'd assume.
This is caused by the fact that it uses several indexes.
(numerical index, usenglish name, locale name, range address)


When you have both "global" and "local" names, or similar names on
several worksheets, you need to know some of it's intricacies.

a global name = it's parent is the workbook
a local name = it's parent is a worksheet.

Officially a local name's name property is like "Sheet1!myRange"
but you can call it (on the same sheet) with it's abbreviated reference
"myRange"

When you start with a sheet which contains "GLOBAL" defined names,
and when you copy that sheet= the copied sheet will contain "LOCAL"
names
and you have an unwanted (confusing) mixture of global and local names.


If a LOCAL name exists on the sheet where you are using it
(either in a macro on the activesheet or in a cell's formula the cells
worksheet) then the abbreviated reference "MyRange" will retrieve the
LOCAL sibling from the Names collection EVEN if a Global sibling exists.


I suggest you check out these addins:
NameIt http://members.chello.nl/keepitcool/downloads
NameEditor http://www.decisionmodels.com/downloads.htm



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"pQp" wrote:

Thanks to all the folk who let us use their hard work for ourselves,
I've found a few great little addins that create a TOC with links for
each page by creating names in A1 of each page. (here's one if anybody
wants something like this
http://www.tushar-mehta.com/excel/so...toccreator.zip)

But after lot of searching, I still can't find a way to do the same
for EVERY named range in a book.
If there's not one about that anyone knows of, could I create my own
by automating the making of links from a sheet of enumerated names
somehow? Or perhaps a click event which passes the name reference to a
goto? ...or sumpthin!

Ta All








 
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
Taking specific rows from on workbook to create another workbook Michelle Excel Worksheet Functions 1 May 12th 07 04:54 AM
create a random list of names from a list of names in EXCEL Givvie Excel Worksheet Functions 2 October 23rd 06 05:10 AM
How to create menu for listed names? Eric Excel Discussion (Misc queries) 8 April 20th 06 07:32 AM
how do I find names in a workbook full of names aj Excel Discussion (Misc queries) 1 January 19th 06 09:01 PM
how do i create range names ? april Excel Worksheet Functions 1 September 5th 05 04:33 AM


All times are GMT +1. The time now is 05:50 AM.

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"