Worksheet_Open and Worksheet_Change Code


Any advice appreciated.

I have Worksheet_Open code in ThisWorkBook which obviously performs actions when the spreadsheet is opened. What I woud like to do is get the same code to run when a Worksheet_Change event occurs in a particular sheet.

Assuning I can't combine Worksheet_Open & Change in a single module(?) how can I call one from the other?

Apologies if this is a question driven by general lack of appreciation of the structure of VBA but any input would help.





Try out my solution and if it doesn't work let me know.

Also, when you get an answer that works, don't forget to "Select" it by clicking the "Select Answer" button at the bottom of it and then clicking "Yes". It doesn't have to be my answer, it's just that some people are not aware of this whole "selecting answer" process.
don (rep: 1825) Jul 13, '16 at 1:00 pm
Add to Discussion



Basically, they call themselves when an action happens.

If you want a particular piece of code to be executed by either of them then just put the macro into its own section in a Module and call the macro from the Worksheet_Open and Change events.

This way, you can access the code from wherever you want in the VBA environment.

To call the macro, you basically just write:

Call macros_name

Here is a small tutorial on it: call a macro from another macro



Many thanks for the response Don.
JohnK Jul 13, '16 at 12:51 pm
Add to Discussion

Answer the Question

You must create an account to use the forum. Create an Account or Login