Hi,
I am after some help with an issue i have come across. I have set up multiple sheets with dynamic names using what is in cell B1 of that sheet. These sheets are hidden and linked to from a master sheet.
The master sheet contains the below wherebang code however as i have now changed the hidden sheets to dynamic names they do not contain the "!" so the wherebang is never hit.
Is there a way i can use the HYPERLINK function so once clicked on the master sheet the hidden sheet is revealed and then the link from the hidden sheet back to the master sheet hides the page again.
I have put this together from different forums online so far so any help would be appreciated.
CODE FROM MASTER SHEET:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
LinkTo = Target.SubAddress
WhereBang = InStr(1, LinkTo, "!")
If WhereBang > 0 Then
MySheet = Left(LinkTo, WhereBang - 1)
Worksheets(MySheet).Visible = True
Worksheets(MySheet).Select
MyAddr = Mid(LinkTo, WhereBang + 1)
Worksheets(MySheet).Range(MyAddr).Select
End If
End Sub
CODE FROM HIDDEN SHEETS:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Worksheets("Combined P&L & Stats").Select
Target.Parent.Worksheet.Visible = False
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Set Target = Range("B1")
If Target = "" Then Exit Sub
On Error GoTo Badname
If Len(Target) > 31 Then
Target = Left(Target, 31)
End If
ActiveSheet.Name = Left(Target, 31)
Exit Sub
Badname:
MsgBox "Please revise the entry in B1." & Chr(13) _
& "It appears to contain one or more " & Chr(13) _
& "illegal characters." & Chr(13)
Range("B1").Activate
End Sub
Thanks