A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
I have looked at this thread several times and without details of the HyperLink and your workbook it is difficult, if not impossible, to test.
However, some advice with code that is in the worksheet's module.
Because you are changing the ActiveSheet (Selecting another worksheet) in the code then this might be your problem because when the ActiveSheet is changed in code from within a module attached to a worksheet, Excel becomes confused and the end results are indeterminable.
If it is necessary to select other worksheets then it is best to place the code in a standard module and call it from the worksheet module and pass the required variables to it like the following example. Note: This code is untested and simply to give you the idea of how to code when changing the ActiveSheet from code within a worksheet module.
'This event code goes in the worksheet's module
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
'Pass the SubAddress to the called sub
Call TestCode(Target.SubAddress)
End Sub
'The following code goes in a standard module
Sub TestCode(strLinkTo As String)
WhereBang = InStr(1, strLinkTo, "!")
If WhereBang > 0 Then
priorsampleprojects = Left(strLinkTo, WhereBang - 1)
Worksheets("priorsampleprojects").Visible = True
Worksheets("priorsampleprojects").Select
MyAddr = Mid(strLinkTo, WhereBang + 1)
Worksheets("priorsampleprojects").Range(MyAddr).Select
End If
End 'Ends processing without returning to calling sub
End Sub
You also need similar coding anywhere that you have code in a worksheets module that changes the ActiveSheet (ie. Selects another worksheet.)