Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Ryan Parker via OfficeKB.com
 
Posts: n/a
Default Hyperlink Location

I have a spreadsheet with a bank of index buttons at the top that are linked
to separate series of data blocks listed below. The panes are frozen right
below the index buttons.

I have linked the top index buttons to a cell at the top of the appropriate
block of data below.

How can I make it so that clicking a hyperlinked index button makes the
linked cell appear at the top of the screen (ie, immediatedly underneath the
frozen panes line)
  #2   Report Post  
Bill Manville
 
Posts: n/a
Default

Try this in the module of the worksheet:

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
With ActiveWindow.Panes(ActiveWindow.Panes.Count)
.ScrollRow = Range(Target.SubAddress).Row
.ScrollColumn = Range(Target.SubAddress).Column
End With
End Sub

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup

  #3   Report Post  
SubSeaGuy
 
Posts: n/a
Default

Bill,

I have the same problem but am using my HL to go from one worksheet to
another. I get an error in the

..ScrollRow = Range(Target.SubAddress).Row

statement. Is there a change I need to make?

SubSeaGuy

"Bill Manville" wrote:

Try this in the module of the worksheet:

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
With ActiveWindow.Panes(ActiveWindow.Panes.Count)
.ScrollRow = Range(Target.SubAddress).Row
.ScrollColumn = Range(Target.SubAddress).Column
End With
End Sub

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup


  #4   Report Post  
Bill Manville
 
Posts: n/a
Default

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 iChar0 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

  #5   Report Post  
SubSeaGuy
 
Posts: n/a
Default

Bill,

That did the trick. Relly appreciate your help.

SubSeaGuy

"Bill Manville" wrote:

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 iChar0 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




  #6   Report Post  
SubSeaGuy
 
Posts: n/a
Default

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

"Bill Manville" wrote:

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 iChar0 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


  #7   Report Post  
Bill Manville
 
Posts: n/a
Default

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing Data from an Access Database Including a Hyperlink Colum B.C.Lioness Excel Discussion (Misc queries) 0 May 16th 05 05:26 PM
hyperlink an excel cell to a specific location wthin application f dirtboy New Users to Excel 1 January 17th 05 08:07 PM
hyperlink an excel cell to a specific location wthin application f dirtboy Excel Discussion (Misc queries) 0 January 17th 05 08:03 PM
Removing hyperlink Frank Marousek Excel Discussion (Misc queries) 3 January 12th 05 09:53 PM
Linked cell location of hyperlink Jerry Excel Worksheet Functions 1 December 20th 04 05:01 PM


All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"