How can I call a module written in Excel by clicking on an ActiveX control in a worksheet?
The code for an ActiveX control, such as a button_click on a worksheet, may be called from other subs, even on other modules. Simply use the keyword "Public" to describe the ActiveX control sub instead of "Private". Then call the sub with a statement such as
It's not entirely clear what you're asking, but I understand this to be your problem:
You have an ActiveX Control that runs on a click event. The VBA for this is only called by the button click and cannot be called from any other Sub, but you would like to be able to call this code from another module.
I don't believe you can do that, but there is a better approach to the problem. Place the code for your ActiveX control in a new Sub in a module. Then replace the code for the button click event with the following: