PDA

View Full Version : Hyperlink to Chart or Range by Double-click Named range



xluser2007
10-28-2009, 01:14 AM
Hi All,

I would like to double click a named range (single-cell) to hyperlink to the desired object stated in the cell contents.

For example, in the sample attached workbook, I have in Sheet1 a named range called "link_ChartScatterPlotSheet3". In "Sheet3" of the same workbook, I have a Chart that is a scatter plot named "ChartScatterPlotSheet3" i.e. same as the named range in "Sheet1", without the first 5 letters "link_" signifying it is the object and not the link to the chart object.

As such, i would like to write the event code in "Sheet1" to double click a named range of the form "link_NameofObject", and then automatically go to that named Object e.g. chart or named range.

In the sample workbook, I can't get this to work, despite trying to use the functions and approach sourced from this (http://www.vbaexpress.com/kb/getarticle.php?kb_id=120) VBAX method here by Zack Baresse for building a TOC for a workbook.

I don;t for example understand how to check whether the named link is for a chart name or a named range to a cell (or cells) i.e. how to use the "IsChart" function in my attached workbook example.

I've had a go at the event code, but it is not working for me.

If anyone could please help that would be appreciated.

regards

RolfJ
10-28-2009, 11:49 AM
I am afraid I might be telling you the obvious, but in the interest of your time and mine I won't be bashful.

I have taken a look at your workbook and can't help wondering why you think you need an event handler to accomplish what I think you are trying to do.

Let's take a look at cell A4 on your Sheet1 worksheet. The cell value is 'Go to Sheet3 Chart named "ChartScatterPlotSheet3"'. Hence I am assuming you want to be able to click on this cell end be transported to the range with that name. However there was no hyperlink assigned to that cell yet.

Have you tried to using the Insert | Hyperlink (or CTRL + K) command from the main menu?

When I use that menu command in your workbook I see the 'Insert Hyperlink' dialog. When I then click on the 'Place in This Document' icon on the left side of the dialog window I see a list of 'Defined Names' in the field to the right of this icon. When I select 'ChartScatterPlotSheet3' from that list and click on OK I have established the hyperlink you may be looking for.

Give it a try.

Hope this helped,
Rolf