I'm working on a excel project where I'm using a scatter chart for a timeline and if a datalabel is click they would like to see another chart show. I having issue with this, I've used excel but have not done too much vba. Is there some starter code or example to get my started? Also I have already built the chart but it not an chart object is there a way to make this chart a clickable chart.
thanks in advance,
Regarding your first question, unfortunately Excel does not provide a way to trigger an event based on a datalabel click. Datalabels and chart series point objects do not support any click events (such as mouseup, mousedown, etc.). I suppose it would be possible to simulate such an event by using the chart mousedown event to run code that would then test all the points to determine if the mouse pointer is within a pixel or two of any point (datalabel) or of a point of interest and then show the other chart, but this would require quite a bit of code.
Regarding your second question, yes this is possible. I assume you mean that your chart is located on a Chart Sheet, rather than being embedded in a worksheet. To do this, right-click on the chart sheet's tab and select View Code. Paste code like this into the Code pane:
Private Sub Chart_MouseUp(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long)
If Button = xlPrimaryButton Then Chart2.Activate
This example will pop Chart2 when you click (left mouse button up) on the first chart sheet (the one containing the code). Note that I'm assuming Chart2 is also a chart sheet.
Incidentally, if your chart is not a chart sheet but is actually a chart object embedded in a worksheet, it is still possible but a bit tricky--let me know if this is the case and I'll provide instructions for it.
Let me know if you need clarification on any of this.
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here