Calling a macro from a macro that displays a chart.
Once the chart is created, should the user click on the chart it will execute a macro.
Sub TestAssignMacro()
' Reference ChartObject by Name
ActiveSheet.ChartObjects("Chart 1").OnAction = _
"CopyChartWithRatio"
' ... or reference ChartObject by Index (it's the same)
ActiveSheet.ChartObjects(1).OnAction = _
"CopyChartWithRatio"
End Sub
Sub CopyChartWithRatio()
' When you click Chart, this macro will run
MsgBox "Hi from Chart"
End Sub