ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hyperlink with an active x control button (https://www.excelbanter.com/excel-programming/432531-hyperlink-active-x-control-button.html)

Doug

Hyperlink with an active x control button
 
I have an active x control button called Sub Button12_Click()
When I click on this button, I would like to have it add a hyperlink to all
the cells M2 through M203. I have another macro that is simular to this but
can't figure out how to get it to work for the active x control button? Can
anybody please help?
--


joel

Hyperlink with an active x control button
 
Post your old code. It should be very simple to modify working code then to
start from scratch.

"Doug" wrote:

I have an active x control button called Sub Button12_Click()
When I click on this button, I would like to have it add a hyperlink to all
the cells M2 through M203. I have another macro that is simular to this but
can't figure out how to get it to work for the active x control button? Can
anybody please help?
--


Doug

Hyperlink with an active x control button
 
This is the old working code.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Application.EnableEvents = True
If Target.Column < 13 Then Exit Sub
Application.EnableEvents = False
ActiveWorkbook.FollowHyperlink Address:= _
"http://moneycentral.msn.com/investor/charts/chartdl.aspx?PT=3&showchartbt=Redraw+chart&compsym s=&D4=1&DD=1&D5=2&DCS=2&MA0=1&MA1=2&CF=4&D8=1&DB=1 &DC=1&D7=&D6=&symbol=" & Target.Value & "&nocookie=1&SZ=2"
Application.EnableEvents = True
End Sub
--
Thank you!


"Joel" wrote:

Post your old code. It should be very simple to modify working code then to
start from scratch.

"Doug" wrote:

I have an active x control button called Sub Button12_Click()
When I click on this button, I would like to have it add a hyperlink to all
the cells M2 through M203. I have another macro that is simular to this but
can't figure out how to get it to work for the active x control button? Can
anybody please help?
--


p45cal[_75_]

Hyperlink with an active x control button
 

something like this?Private Sub CommandButton1_Click()
'remove old hyperlinks:
For Each hyp In Range("M2:M203").Hyperlinks
hyp.Delete
Next hyp
'add new ones:
For Each cll In Range("M2:M203")
ActiveSheet.Hyperlinks.Add Anchor:=cll,
Address:="http://moneycentral.msn.com/investor/charts/chartdl.aspx?PT=3&showchartbt=Redraw+chart&compsym s=&D4=1&DD=1&D5=2&DCS=2&MA0=1&MA1=2&CF=4&D8=1&DB=1 &DC=1&D7=&D6=&symbol="
& cll.Value & "&nocookie=1&SZ=2"
Next cll
End Sub


--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=126203



All times are GMT +1. The time now is 06:16 AM.

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