![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
How do I insert a hyperlink for a worksheet in a workbook?
I have a macro that creates a summary page with all names of the workbook on this summary page. I’d like to add code that would link the cells with the workbook names to the respective worksheets. Here’s what I have so far. For Each ws In Sheets x = x + 1 'x + 1 makes it go to the next row to paste ws.name Sheets("Summary").Range("A" & x).Value = ws.Name Next ws Thanks! |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Forget what you have done and download ASAP:
http://asap-utilities.com/ It has a command that will "Create an index page with all sheets (clickable)" That should do the trick for you. Everyone should download this program; I have found it so useful. _________________ Hope this helps. Kind regards, Al. [ This Message was edited by: Al Chara on 2002-04-10 12:42 ] |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
|
...and if you want to learn something along the way, try this:
Hope it helps, Russell |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
Al,
Thanks, but I think the IT people here would frown on my installing an add-in. Russell, Thanks, but it doesn't work. I did an edit Hyperlink and the links are there as Cell References but the hyperlinked cells are empty. |
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
|
It worked for me. Check the color of the text in those cells. You changed "Sheet1" to "Summary", right?
|
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
|
Try this instead:
|
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
Got it to work. Had to change this.
.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:=ws.Name & "!A1" To this. .Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:="'" & ws.Name & "'!A1" EDIT: That SubAddress:="'" & ws.Name & "'!A1" is hard to make out but it's SubAddress:=" ' " & ws.Name & " ' !A1" I didn't include the Option Explicit before Sub CreateHyperLinks(), does that make a difference. What does Option Explicit do? Sub CreateHyperLinks() Dim ws As Worksheet For Each ws In Sheets With Sheets("Sheet1").Cells(ws.Index, 1) .Select .Value = ws.Name .Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:="'" & ws.Name & "'!A1" End With Next ws End Sub [ This Message was edited by: Cosmos75 on 2002-04-10 13:43 ] |
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
|
Interesting. It worked without the single quotes for me (XL2000).
|
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
Excel 2000 here as well... Hmm, interesting...?
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|