Reputation: 13
I have an activeX button that creates monthly charts from data logs that change daily. When you select a chart from a particular month, I want to display the min, max, and average chart values in cells B1-B3.
I imagine this is pretty easy if you have a fixed chart such as "chart1" but the user could create any number of charts on several different sheets so I don't know in advance what charts are even available.
Is there a way to create a generic chart_Activate listener that can call a sub and send it the chart's y values when any chart is activated?
Something like
Sub Chart_Activate()
yValues = <some property obtained from this listener>
Call findMinMaxAvg(ByVal yValues)
End Sub
Upvotes: 0
Views: 40
Reputation: 166196
You can assign a common Sub to each chart's OnAction
property - name your charts so that sub can extract the information it needs via Application.Caller
Sub ShowInfo()
Debug.Print Application.Caller
End Sub
Upvotes: 2