Try this:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim iChar as Integer
Dim stAddr As String
stAddr = Target.SubAddress
iChar = InStr(stAddr,"!") ' Sheet!Range ?
If iChar>0 Then
Sheets(Left(stAddr,iChar-1)).Activate
stAddr = Mid(stAddr, iChar+1)
End If
With ActiveWindow.Panes(ActiveWindow.Panes.Count)
.ScrollRow = Range(stAddr).Row
.ScrollColumn = Range(stAddr).Column
End With
End Sub
I think it should work for links to any sheet in the workbook
Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup
SubSeaGuy - 25 Jun 2005 09:03 GMT
Bill,
That did the trick. Relly appreciate your help.
SubSeaGuy
> Try this:
>
[quoted text clipped - 18 lines]
> MVP - Microsoft Excel, Oxford, England
> No email replies please - respond to newsgroup
SubSeaGuy - 25 Jun 2005 18:41 GMT
Bill,
Sorry to be so worrysome. The sub worked great when the hyperlink was cell
text with a hyperlink attached to it. I linked a hyperlink to a text box and
it seems to ignore the sub????? Any thoughts?
SubSeaGuy
> Try this:
>
[quoted text clipped - 18 lines]
> MVP - Microsoft Excel, Oxford, England
> No email replies please - respond to newsgroup
Bill Manville - 26 Jun 2005 08:45 GMT
I guess the Sheet_FollowHyperlink event only occurs for hyperlinks in
cells, not in objects on the sheet, which doesn't surprise me.
You could assign a macro to the textbox instead of using a hyperlink,
e.g.
Sub GoSomePlace()
Application.Goto Sheets("SomeSheet").Range("SomeNameOrAddress"),
Scroll:=True
End Sub
OR, for links which go to another sheet, if you were happy that every
time you activate the destination sheet the active cell is scrolled to
the top left-hand corner, put this in the module of that sheet:
Private Sub Worksheet_Activate()
Application.Goto ActiveCell, True
End Sub
Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup