Hyperlink to cell and have it appear at top upper left hand corner

B

Bisonhawk

I am new user. I have created 3 worksheets and defined names for certain
cells. I have then created hyperlinks for those cells to go to other named
cells. My problem is that when I click on the hyperlinked cell, Excel goes
to the correct cell but I would like to have it appear at the top left corner
of the spreadsheet. It instead might appear at the middle or right hand side
of the spreadsheet. What can I do to correct this? Thank you in advance
for anyones response.
 
G

galimi

There must be a better way, but I would programatically check the left & top
values of the cell and move a temporary cursor right & down until the
original cell was as close to zero on the left & top as possible.
 
B

Bisonhawk

I'm not sure how I would go about doing that. I also have some defined names
with hyperlinks on the same sheet. Example: Cell A100 links to AA2. When I
click on A100, it takes me to AA2 but it is clear to the right of the screen.
 
G

Gary''s Student

If you are hyperlinking between cells on the same sheet, Insert this tiny
event macro in the worksheet code area:

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Application.Goto ActiveCell, scroll:=True
End Sub

This will not work with hyperlinks created by functions.


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm
 
B

Bisonhawk

Thank you very much for the information. I applied this macro to my
worksheet and it works GREAT!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top