Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-27-2017, 06:12 AM
NoSparks NoSparks is offline Auto Generation of Hyperlinks Windows 7 64bit Auto Generation of Hyperlinks Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

I used the macro recorder to see how/where Excel uses the sheet name.
Give this a try...
Code:
Sub createHyperlinks_2()
'
' Macro to create hyperlinks
'
'
Dim tocText As String       ' variable to hold text to appear in table of contents
Dim sh As String            ' holds name of worksheet to be linked to
Dim selectedCell As Range   ' holds cell reference of cell I want to be linked to

sh = ActiveSheet.Name
Set selectedCell = ActiveCell
tocText = ActiveCell.Text
Sheets("Table of Contents").Select

ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", _
        SubAddress:=sh & "!" & selectedCell.Address, TextToDisplay:=tocText

End Sub
Reply With Quote
 

Tags
hyperlinks, toc



Similar Threads
Thread Thread Starter Forum Replies Last Post
Reports Filter Generation ebilbrough Project 3 01-05-2016 06:13 AM
Auto Generation of Hyperlinks Awkward dropdown list generation copwriter Excel 3 06-28-2014 05:59 PM
Auto Generation of Hyperlinks Invoice Number Generation mrphilk Excel 2 06-08-2010 12:39 PM
How to reduce top margin in even and odd pages in pdf generation using msword Nandu4u Word 0 11-20-2009 07:16 AM
Templates: automatic text generation from Rich Text content control Chickenmunga Word 0 10-01-2008 11:16 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:51 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft