Hi all,
I have a worksheet VBA macro to install an index hyperlink into the workbook spreadsheets that is activated upon going to the index worksheet itself. (clicking tab) or clicking the hyperlink to the index sheet in cell A1. There is no problem in the Excel 2010 or 2013 environment. My problem only occurs using Excel 2016.
If the user clicks the hyperlink in cell A1 to get back to the index sheet, there is no problem, however, if the user gets back to the index sheet by instead clicking the index sheet TAB, then the cell last active in that sheet is given hyperlink font style rather than the intended (and assigned by the VBA macro) cell A1 and the cell containing the hyperlink receives basic non-hyperlink style font.
Essential coding:
Private Sub Worksheet_Activate()
Dim wSheet as Worksheet
...
For Each wSheet In Worksheets
With wSheet
.Range("A1").Name = "Start_" & wSheet.Index 'Sets up naming A1 cell in each spreadsheet tab
'Hyperlink lines below writes the hyperlink in each spreadsheet tab with reference back to Index sheet
.Hyperlinks.Add Anchor:=.Range("A1"), Address:="", _
SubAddress:="Index", TextToDisplay:="INDX"
End With
Next wSheet
End Sub
I've tried doing activating the intended hyperlink cell on the desired worksheet within the With-loop, but that breaks the looping and ends up causing an infinite looping.
I'm thinking of trying to capture the specific worksheet name that the user was last on before clicking the index worksheet tab via an event capture and ensuring I select and activate the worksheet's A1 cell ahead of the looping. I'd need help with doing the event capture.
Thoughts, please.
Thanks,
Clay
I have a worksheet VBA macro to install an index hyperlink into the workbook spreadsheets that is activated upon going to the index worksheet itself. (clicking tab) or clicking the hyperlink to the index sheet in cell A1. There is no problem in the Excel 2010 or 2013 environment. My problem only occurs using Excel 2016.
If the user clicks the hyperlink in cell A1 to get back to the index sheet, there is no problem, however, if the user gets back to the index sheet by instead clicking the index sheet TAB, then the cell last active in that sheet is given hyperlink font style rather than the intended (and assigned by the VBA macro) cell A1 and the cell containing the hyperlink receives basic non-hyperlink style font.
Essential coding:
Private Sub Worksheet_Activate()
Dim wSheet as Worksheet
...
For Each wSheet In Worksheets
With wSheet
.Range("A1").Name = "Start_" & wSheet.Index 'Sets up naming A1 cell in each spreadsheet tab
'Hyperlink lines below writes the hyperlink in each spreadsheet tab with reference back to Index sheet
.Hyperlinks.Add Anchor:=.Range("A1"), Address:="", _
SubAddress:="Index", TextToDisplay:="INDX"
End With
Next wSheet
End Sub
I've tried doing activating the intended hyperlink cell on the desired worksheet within the With-loop, but that breaks the looping and ends up causing an infinite looping.
I'm thinking of trying to capture the specific worksheet name that the user was last on before clicking the index worksheet tab via an event capture and ensuring I select and activate the worksheet's A1 cell ahead of the looping. I'd need help with doing the event capture.
Thoughts, please.
Thanks,
Clay