ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User selection from a chart (https://www.excelbanter.com/excel-programming/405141-user-selection-chart.html)

Nathan Smith

User selection from a chart
 
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.

Jon Peltier

User selection from a chart
 
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
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Nathan Smith" wrote in message
...
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.





All times are GMT +1. The time now is 03:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com