ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro attached to Autoshape Hyperlink not invoking (https://www.excelbanter.com/excel-discussion-misc-queries/446332-macro-attached-autoshape-hyperlink-not-invoking.html)

kenman

Macro attached to Autoshape Hyperlink not invoking
 
Hi
I have a Hyperlink associated with an Autoshape. The purpose of the
hyperlink is to to scroll to another part of the worksheet.
However, I want to target cells of the hyperlink to appear at the top of
the page instead of the bottom.

I found a good suggestion on the forum on how to do this - see below.

If I create a hyperlink on a cell, this works great and I can see that the
macro gets executed.
However for the hyperlink associated with the autoshape, the macro does not
get invoked.

Any Ideas why ? I am using Excel 2003.


1. start with a fresh, brand new, worksheet.
2. select A1 in Sheet1 and pull-down:
a. Insert Hyperlink Place in this document B9
3. click the link to insure we get to B9
4. right-click the tab (sheet name) at the bottom and select View code
5. Paste this in:

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim s As String
MsgBox ("re-scrolling")
s = ActiveCell.Address(ReferenceStyle:=xlR1C1)
Application.Goto Reference:=s, Scroll:=True
End Sub

Any help appreciated


All times are GMT +1. The time now is 04:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com