excel - Adding A Hyperlink To An Individual Chart Series -
i have selected first series of chart using following code:
activesheet.chartobjects(1).activate activechart.seriescollection(1).select
how add hyperlink series? each chart series have different hyperlink, same seriescollection(2) , on.
many thanks
adding code in workbook:
public withevents cht chart const linkvar = "http://www.google.com" private sub workbook_open() set cht = worksheets(1).chartobjects(1).chart end sub private sub cht_select(byval elementid long, byval arg1 long, byval arg2 long) on error goto fin if selection.name = "series1" activeworkbook.followhyperlink address:=sheet2.range("a1").value, _ newwindow:=true end if if selection.name = "series2" activeworkbook.followhyperlink address:=linkvar, _ newwindow:=true end if fin: end sub private sub workbook_sheetselectionchange(byval sh object, byval target range) if cht nothing set cht = worksheets(1).chartobjects(1).chart end if end sub
you add select event connected chart.
inside event check select , connect dynamic hyperlink.
if have more 1 chart, it's necessary check name of chart...
(a little note: me how ...)
have modify little adding reference cell in sheet , add address in const.
have add event selectionchange, because when modify code cht var set on nothing... in event check , reset.
check have in cell referenced correct syntax...
Comments
Post a Comment