Excel 2016 VBA Hyperlinks Problem

claywhit

New Member
Joined
Sep 5, 2016
Messages
8
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
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top