User selection from a chart

  • Thread starter Thread starter Nathan Smith
  • Start date Start date
N

Nathan Smith

I have a VB app that uses a VBA script to create a sheet with data and then
another sheet with a chart representing that data in graphical form. The
sheet with the data on it has formulas that are run on a subset of the data.
Currently these formulas are hardcoded with the range to calculate from. But
I need to change it so the user can select a starting and ending point from
the chart (on the other page) that the formulas will use to calculate from.

I am new to Office scripting so any ideas on how to do this (if it's even
possible) would be helpful.

Thanks.
 
You can determine which chart element is selected using the Selection
object, but it's tedious to do this to get more than one selection, because
you have to make the user stop, select something else. then click something
to continue the code.

You can also use chart events to respond to mouse actions in the chart. It's
a bit tricky, especially if you've done little programming, but here's a
reasonably straightforward tutorial:

http://www.computorcompanion.com/LPMArticle.asp?ID=221

I've used this technique to do much the same as you, let the user easily
select the first and last point for detailed analysis.

- Jon
 
Back
Top