Then pushing the button will execute the macro. Then associate that command button with the macro GetTrendlineEquation (right click button and associate should do it). Generally, less problematic than ActiveX objects. Ribbon > developer tab > controls > form controls. a command button from the forms control is simpliest.
You could tie this to a Worksheet_Change event where the target is your Y range, but set it so is only triggered once per updateĢ) You could tie to the execution of the macro to a control.Į.g. The advantage below is to show you how to start checking the trend type is the one you want and serves as the basis for expanding to loop over other series if needed. I also give an in sheet method for completeness. DataLabel.Text to write out the formula using VBA.