Hyperlink help

C

cdb

I have created some hyperlinks within a spreadsheet so that when one is clicked it activates the sheet the link is refering to. What I would now like to do is that when this hyperlink (and subsequently the sheet) is selected, I want it to automatically run a marco.
Is this possible?
 
D

Dave Peterson

You may be able to use the worksheet_activate event--depending on your version
of excel.

In xl2002, I rightclicked on my "to" worksheet and selected view code.

I pasted this in the code window:

Option Explicit
Private Sub Worksheet_Activate()
MsgBox "hi"
End Sub


In xl2002, when the worksheet is activated (including via the link), this event
will fire.

IIRC, in xl2k, this event didn't fire when initiated via a hyperlink.

One way around it is to get rid of the hyperlinks and use code to do the
"movement".
 
D

David McRitchie

instead of MsgBox "Hi" you would use simply
use the macro name in it's place. If that does not work
see http://www.mvps.org/dmcritchie/excel/install.htm#activate
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

Dave Peterson said:
You may be able to use the worksheet_activate event--depending on your version
of excel.

In xl2002, I rightclicked on my "to" worksheet and selected view code.

I pasted this in the code window:

Option Explicit
Private Sub Worksheet_Activate()
MsgBox "hi"
End Sub


In xl2002, when the worksheet is activated (including via the link), this event
will fire.

IIRC, in xl2k, this event didn't fire when initiated via a hyperlink.

One way around it is to get rid of the hyperlinks and use code to do the
"movement".
What I would now like to do is that when this hyperlink (and subsequently the sheet) is selected, I want it to automatically run a
marco.
 
D

Danielle

How do you create a link that activates another sheet? I can only seem to
create one that references a particular cell. I want to create a menu on
sheet1 that links (using ActiveX buttons) into the other sheets. Any ideas?
 
F

Frank Kabel

Hi
use a reference like the following:
#Sheet2!A1

--
Regards
Frank Kabel
Frankfurt, Germany

Danielle said:
How do you create a link that activates another sheet? I can only seem to
create one that references a particular cell. I want to create a menu on
sheet1 that links (using ActiveX buttons) into the other sheets. Any ideas?
one is clicked it activates the sheet the link is refering to. What I
would now like to do is that when this hyperlink (and subsequently the
sheet) is selected, I want it to automatically run a marco.
 
Top