May 14 2021 04:29 PM
When the user selects a point in a chart series (it's a scatter plot), it triggers an EventChart_Select event. In the event code, I change the appearance of the point so if the user looks away from the screen and looks back again, they can still see the point they have selected.
When the point is no longer selected, I want to change its appearance back to "normal." Unfortunately, there is no single event that I'm aware of (I'm relatively new to VBA) where this can be done. If the selection changes because a cell on the worksheet selected, it triggers a Worksheet_SelectionChange event. If the selection changes because something else on the chart is selected, it triggers another EventChart_Select event. So if I want to change the appearance of the point, I need to add code in both places. It feels like there should be a better way. Is there?
May 15 2021 01:13 AM
You could store the most recently highlighted point in a public variable, and create a "reset" procedure that resets this point. You can then call this from the Worksheet_SelectionChange event procedure and from the Chart_Select event procedure, in the latter case before highlighting a new point if applicable.
May 15 2021 12:47 PM