Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Follow link from Window("1") in Window("2") possible?

2003

Attempting to effectively use two windows currently "tiled"

Prefer a link "Sheet1"; Window("xxx:1") be followed in Window("xxx:2")
on "Sheet7"

Windows("Book.xls:1").Activecell.Hyperlinks(1).Fol low NewWindow:=True,
AddHistory:=True

I activated Windows("Book.xls:2") and attempted the above code
in the immediate window but the "follow" occured in
Windows("Sheet1:1").

Appreciate a response ASARP Thank you!!

Dennis

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Follow link from Window("1") in Window("2") possible?

Dennis,
From a bit of testing, it seems hyperlinks (and .Goto) always operate on the
window with .WindowNumber=1 rather than the ActiveWindow.
Also, the FollowHyperLink event fires after the new selection is made, so
you cannot cancel it the hyperlink.
The Windows collection behaves differently to other collections in that the
(index) changes;
<From Help
Note that the active window is always Windows(1).
</From Help
So you need to create the caption and use that.

This seems to work by faking a hyperlink (its actual address is the cell
that holds it, but the .TextToDisplay is in the form
"WindowNumber!Sheetname!Range"
e.g. "2!Sheet2!A3", but you can use any delimiter you want, as it has no
special meaning here

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim WindowText As String

WindowText = ThisWorkbook.Name & ":" & Split(Target.TextToDisplay, "!")(0)
Windows(WindowText).Activate

With Worksheets(Split(Target.TextToDisplay, "!")(1))
.Activate
.Range(Split(Target.TextToDisplay, "!")(2)).Select
End With

End Sub

Others may have a better way.

NickHK

"Dennis" wrote in message
ps.com...
2003

Attempting to effectively use two windows currently "tiled"

Prefer a link "Sheet1"; Window("xxx:1") be followed in Window("xxx:2")
on "Sheet7"

Windows("Book.xls:1").Activecell.Hyperlinks(1).Fol low NewWindow:=True,
AddHistory:=True

I activated Windows("Book.xls:2") and attempted the above code
in the immediate window but the "follow" occured in
Windows("Sheet1:1").

Appreciate a response ASARP Thank you!!

Dennis



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
How can I "re-hook" my worksheet window to my Excel window? Jal Excel Discussion (Misc queries) 0 August 29th 08 09:38 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Excel 2003 VBA - "Maximizing" Window & "Calculating" Workbook JingleRock Excel Programming 0 April 25th 06 05:04 AM
freeze window creates multiple "views" suffixed with ":n" dgaex001 Excel Discussion (Misc queries) 5 March 22nd 06 05:28 PM
VBA command to say "yes"/"no" to popup window Manuel Excel Programming 7 August 5th 04 10:20 AM


All times are GMT +1. The time now is 11:27 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"