Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 19th, 2006, 08:21 PM
Authorized User
 
Join Date: Jun 2006
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default hyperlink - top/bottom of screen

Hi,

I have hyperlinks in a sheet that simply take you to other places in the same sheet. The problem I am facing is that on some computers, clicking on a link (let's say it's destination is cell A101), shows that cell (A101) at the bottom of the visible screen, whereas on other computers, clicking on the same link shows the cell (A101) at the top of the visible screen. What I need is for it to always show at the top. The versions of Excel on these machines are the same...so I'm wondering is there a setting somewhere in Excel that this needs to be set?

Please do respond, I need this to work!

Thank you,
Kriti

 
Old July 20th, 2006, 02:24 AM
SMI SMI is offline
Authorized User
 
Join Date: Jul 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello
Copy the following code in worksheet's hyperlink event

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)

' This is the single line that does the job
   ActiveWindow.ScrollRow = ActiveCell.Row

End Sub

Obvioulsy, whenever you click a hyperlink, it takes you to a specfied location in your worksheet, then you can use "ActiveCell.Row" property to do required scroll and that's all done.


Genius is 99% perspiration and 1% inspiration
 
Old July 20th, 2006, 10:24 AM
Authorized User
 
Join Date: Jun 2006
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you so so much. It worked great.

 
Old December 1st, 2006, 11:12 AM
Authorized User
 
Join Date: Jun 2006
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I'm having some trouble again! It turns out that the Worksheet_FollowHyperlink event (or in my case the Workbook_SheetFollowHyperlink event) is triggered only if the hyperlink clicked is a TEXT hyperlink, and not if it is a shape hyperlink. Is there a way to rectify this? Because I need the "ActiveWindow.ScrollRow = ActiveCell.Row" code to be executed when shape hyperlinks are clicked as well.

Thank you!
Kriti






Similar Threads
Thread Thread Starter Forum Replies Last Post
Open a PDF as top screen JeffGirard Access VBA 1 January 30th, 2007 08:28 PM
treeview: top down and bottom up approach patan_campus ASP.NET 2.0 Professional 0 August 24th, 2006 11:35 PM
SELECT TOP n NOT SELECTING TOP n! ibi SQL Language 8 March 30th, 2005 08:08 PM
top row on the screen aspadda Excel VBA 1 December 19th, 2003 03:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.