LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default Adding hyperlinks to macro-generated sheets from list of sheet nam

Hi,

I have code that generates sheets from a list in a column. I would like to
add hyperlinks that link the values in Column C or Column D (whichever the
user enters in a drop-down code) to the respective sheet which was generated.

This is the simplified version. The actual code create a series of 6 pivot
tables using this value in Column C or D as their page filters. All I want to
do is create the hyperlink to the generated sheet as well.

Here is the code that I have so far:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim pi As PivotItem
Dim sh As Worksheet
Dim pt As PivotTable


ActiveWorkbook.PrecisionAsDisplayed = False
Application.DisplayAlerts = False
Application.ScreenUpdating = False
With Application
.Calculation = xlManual
.MaxChange = 0.001
End With

If Target.Count 1 Then Exit Sub
If Len(Trim(Target)) = 0 Then Exit Sub
If Target.Column = 3 Or Target.Column = 4 Then

Sheets("PIV_Template").Visible = True

Worksheets("PIV_Template").Copy _
After:=Worksheets(Worksheets.Count)

Sheets("PIV_Template").Visible = False

Set sh = ActiveSheet
sh.Name = Target
For Each pt In sh.PivotTables
With pt
If Target.Column = 3 Then
With .PivotFields("ITBGrp")
For Each pi In .PivotItems
If LCase(pi.Value) = LCase(Target.Value) Then
.CurrentPage = pi.Value
End If
Next
End With
ElseIf Target.Column = 4 Then
With .PivotFields("IO_Grp")
For Each pi In .PivotItems
If LCase(pi.Value) = LCase(Target.Value) Then
.CurrentPage = pi.Value
End If
Next
End With
End If
End With
Next

sh.Activate
End If
Call Format_Grouping_Titles
Call Format_Columns
Call Format_Titles

ActiveWorkbook.PrecisionAsDisplayed = True
Application.DisplayAlerts = True
Application.ScreenUpdating = True
With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With

End Sub



I do know that the code below did the trick in another solution that I
developed previously, but I can't figure out how to adapt it to the code
above.


cell.Hyperlinks.Add Anchor:=cell, _
Address:="", _
SubAddress:="'" & ActiveSheet.Name & "'!A1", _
TextToDisplay:=cell.Value


Any help would be very much appreciated!
Kent.
--
Kent Lysell
Financial Consultant
Ottawa, Ontario
W: 613.948-9557
 
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
Adding row to sheet; having hyperlinks follow Ryan Vande Excel Worksheet Functions 2 October 18th 09 02:40 AM
Making Hyperlinks from a list of sheet names Philip J Smith Excel Programming 12 March 16th 07 09:27 AM
Randomly Generated List / Macro carl Excel Worksheet Functions 3 April 9th 06 01:14 AM
Adding Sheets with names from a list. Casey[_63_] Excel Programming 2 April 4th 06 04:31 PM
Adding rows from sheets to one sheet Jason L Excel Programming 3 January 11th 05 08:07 PM


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