Hyperlink to a Chart

M

Mark Attebury

I am trying to figure out how to create a hyperlink to a
chart. I have one tab that is a table of contents and I
want the reader to be able to click on the hyperlink and
go straight to a specific chart. I can make it take them
to various reports that I have created, but not to a chart.
 
J

Jon Peltier

You can use a macro like this:

Sub ActivateChart()
Charts("Chart1").Activate
End Sub

Draw a rectangle in the worksheet, sized to cover the cell exactly and
formatted to look like it belongs there (or make it invisible), then
right click on the rectangle, select Assign Macro from the popup menu,
and choose the macro.

Rather than the rectangle, you can use a worksheet_selectionchange
procedure to run the ActivateChart macro:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("B2")) Is Nothing Then
ActivateChart
End If
End Sub

The above runs the macro when B2 is selected. Right click on the sheet
tab, select View Code, and paste the macro into the code window that
appears. Actually, you can bypass the ActivateChart macro with this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("B2")) Is Nothing Then
Charts("Chart1").Activate
End If
End Sub

- Jon
 

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