#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 355
Default Hyperlink Help

I have a workbook with 100 worksheets. The first worksheet contains a list of
all the worksheet names in the workbook. How can I convert this list to
hyperlinks to each sheet within a vba macro.

I have tried the hyperlink finction hyperlink(cell reference) but it results
in an invalid hyperlink.

Thank you
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 695
Default Hyperlink Help

Give the Function Hyperlink another try like :

=HYPERLINK("[Workbook1.xls]"&OFFSET(A2,,,,)&"!A1","Jump to sheet : "&A2&"
Celles A1")

this one jump to the sheetname u have in cells A2
remember Workbook1 have to be saved at least 1 time !!


"Sandy" skrev:

I have a workbook with 100 worksheets. The first worksheet contains a list of
all the worksheet names in the workbook. How can I convert this list to
hyperlinks to each sheet within a vba macro.

I have tried the hyperlink finction hyperlink(cell reference) but it results
in an invalid hyperlink.

Thank you

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Hyperlink Help

If you still want to go with the VBA solution, try this one. To put it into
your workbook, press [Alt]+[F11] to open the VB Editor, choose Insert |
Module and cut and paste the code below into the module. Change the sheet
name and "home cell" values as needed for your workbook. Then use Tools |
Macro | Macros to run the macro.

Sub MakeTOC()
Dim tocWS As Worksheet
Dim tocHome As Range
Dim anyWS As Worksheet
Dim mySubAddress As String
Dim homeCellAddress As String
Dim tocEntryCount As Integer

'change these as needed
'provide name of sheet to have the Table of Contents
Set tocWS = Worksheets("Sheet1")
'change to whatever cell you'd like to go to on a sheet
'via the hyperlink
homeCellAddress = "A1"

'this all assumes that the TOC sheet is now empty
tocWS.Activate
Set tocHome = tocWS.Range("A1")
Application.ScreenUpdating = False ' speed things up
For Each anyWS In Worksheets
If anyWS.Name < tocWS.Name Then
'add it to the Table of Contents list
mySubAddress = "'" & anyWS.Name & "'!" & _
homeCellAddress
'need to add hyperlink also
tocHome.Offset(tocEntryCount, 0).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, _
Address:="", SubAddress:= _
mySubAddress, TextToDisplay:=anyWS.Name
tocEntryCount = tocEntryCount + 1
End If
Next
End Sub


"Sandy" wrote:

I have a workbook with 100 worksheets. The first worksheet contains a list of
all the worksheet names in the workbook. How can I convert this list to
hyperlinks to each sheet within a vba macro.

I have tried the hyperlink finction hyperlink(cell reference) but it results
in an invalid hyperlink.

Thank you

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 355
Default Hyperlink Help

This works great ---- thanks

"JLatham" wrote:

If you still want to go with the VBA solution, try this one. To put it into
your workbook, press [Alt]+[F11] to open the VB Editor, choose Insert |
Module and cut and paste the code below into the module. Change the sheet
name and "home cell" values as needed for your workbook. Then use Tools |
Macro | Macros to run the macro.

Sub MakeTOC()
Dim tocWS As Worksheet
Dim tocHome As Range
Dim anyWS As Worksheet
Dim mySubAddress As String
Dim homeCellAddress As String
Dim tocEntryCount As Integer

'change these as needed
'provide name of sheet to have the Table of Contents
Set tocWS = Worksheets("Sheet1")
'change to whatever cell you'd like to go to on a sheet
'via the hyperlink
homeCellAddress = "A1"

'this all assumes that the TOC sheet is now empty
tocWS.Activate
Set tocHome = tocWS.Range("A1")
Application.ScreenUpdating = False ' speed things up
For Each anyWS In Worksheets
If anyWS.Name < tocWS.Name Then
'add it to the Table of Contents list
mySubAddress = "'" & anyWS.Name & "'!" & _
homeCellAddress
'need to add hyperlink also
tocHome.Offset(tocEntryCount, 0).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, _
Address:="", SubAddress:= _
mySubAddress, TextToDisplay:=anyWS.Name
tocEntryCount = tocEntryCount + 1
End If
Next
End Sub


"Sandy" wrote:

I have a workbook with 100 worksheets. The first worksheet contains a list of
all the worksheet names in the workbook. How can I convert this list to
hyperlinks to each sheet within a vba macro.

I have tried the hyperlink finction hyperlink(cell reference) but it results
in an invalid hyperlink.

Thank you

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Hyperlink Help

Glad I could help.

Enjoy!

"Sandy" wrote:

This works great ---- thanks

"JLatham" wrote:

If you still want to go with the VBA solution, try this one. To put it into
your workbook, press [Alt]+[F11] to open the VB Editor, choose Insert |
Module and cut and paste the code below into the module. Change the sheet
name and "home cell" values as needed for your workbook. Then use Tools |
Macro | Macros to run the macro.

Sub MakeTOC()
Dim tocWS As Worksheet
Dim tocHome As Range
Dim anyWS As Worksheet
Dim mySubAddress As String
Dim homeCellAddress As String
Dim tocEntryCount As Integer

'change these as needed
'provide name of sheet to have the Table of Contents
Set tocWS = Worksheets("Sheet1")
'change to whatever cell you'd like to go to on a sheet
'via the hyperlink
homeCellAddress = "A1"

'this all assumes that the TOC sheet is now empty
tocWS.Activate
Set tocHome = tocWS.Range("A1")
Application.ScreenUpdating = False ' speed things up
For Each anyWS In Worksheets
If anyWS.Name < tocWS.Name Then
'add it to the Table of Contents list
mySubAddress = "'" & anyWS.Name & "'!" & _
homeCellAddress
'need to add hyperlink also
tocHome.Offset(tocEntryCount, 0).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, _
Address:="", SubAddress:= _
mySubAddress, TextToDisplay:=anyWS.Name
tocEntryCount = tocEntryCount + 1
End If
Next
End Sub


"Sandy" wrote:

I have a workbook with 100 worksheets. The first worksheet contains a list of
all the worksheet names in the workbook. How can I convert this list to
hyperlinks to each sheet within a vba macro.

I have tried the hyperlink finction hyperlink(cell reference) but it results
in an invalid hyperlink.

Thank you



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
Can't make hyperlink function work for hyperlink to website Frank B Denman Excel Worksheet Functions 15 February 5th 07 11:01 PM
How do I create a hyperlink to a cell with the hyperlink function S. Bevins Excel Worksheet Functions 2 July 20th 06 08:06 PM
Moving rows with Hyperlink doesn't move hyperlink address Samad Excel Discussion (Misc queries) 15 June 22nd 06 12:03 PM
Hyperlink from one sheet to the hyperlink on another AO Excel Discussion (Misc queries) 2 July 5th 05 11:27 AM
Intra-workbook hyperlink: macro/function to return to hyperlink ce marika1981 Excel Discussion (Misc queries) 3 May 6th 05 05:47 AM


All times are GMT +1. The time now is 07:31 PM.

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"