Hyperlinks to charts

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 09:41 PM GMT


QUESTION: I've been reading up on the following literature regarding code for hyperlinking to charts in excel. http://www.excelforum.com/excel-general/605935-hyperlink-to-chart-sheets.html http://excel.tips.net/Pages/T002539_Hyperlinks_to_Charts.html http://en.allexperts.com/q/Excel-1059/Dynamic-link-generation-charts-1.htm

Essentially, I keep getting errors when I try to use any of these, because mydocument is for users to view data for an upcoming release of a book. My constraints that stop these from working however are: 1. I do not want to rename the worksheet/chart tab titles so that they have no spaces (I currently get errors when I try to link to charts with spaces in their name, I don't know if there is a way to put quotes around the name of the chart to link or something).

Thus this example does not work correctly: Sub GotoChart1()


End Sub

2. I want to have different text that the chart name in the cell being clicked.

Thus this example does not work correctly: Sub GotoChart1()


End Sub

Thank you so much for the assistance!

ANSWER: I'm not sure I follow -- what happens when you use Sheets("Chart1").Select ??

You can refer to the sheet's code name -- Chart1.Select for example.

---------- FOLLOW-UP ----------

QUESTION: "Sub GotoWorld Grain Production (g)()

 Sheets("World Grain Production (g)").Select

End Sub

I get a Compile Error: Expected end of statement. (and line one turns red) It seems like that it expects the space to be the end of the statement. I need a way to have the name use spaces (every example I've seen online is of, for example, "Chart1" not "Chart 1").

Oh! and My fault, the second example of code I attempted to paste (it didn't catch it merely pasted the first example again) was: Private Sub Worksheet_SelectionChange(ByVal Target As Range)

 If target.address = range("B2").address then
end sub

And as I said earlier this doesn't work because I need the cell that is being clicked on to have a fuller title instead of the shortened title of the chart, for example: clicking a cell with the text showing "GRAPH: World Grain Production, 1960-2010" must lead to chart "World Grain Production (g)"

Thanks again!"


The name of the Sub MUST not contain spaces, so you simply can't use Sub GotoWorldGrain Production (g)()

If a cell contains GRAPH: World Grain Production, 1960-2010 and you want that to activate a chart named "World Grain Production (g)" then there has to be some logical connection between the 2. What happened to the ", 1960-2010" part, and where did the "(g)" part come from? If you can supply the rule, then it still can be done, but it WOULD be something in the SelectionChange event. I'd need to know the rule. How wouldknow to activate World Grain Production (g) if you click on a cell which says GRAPH: World Grain Production, 1960-2010??


©2021 eLuminary LLC. All rights reserved.