ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add event code through a macro (https://www.excelbanter.com/excel-programming/281179-add-event-code-through-macro.html)

Hans Bergman

Add event code through a macro
 

My VBA code creates new sheets. I want my VBA code to add
event code for the newly created sheet. Any idea how?

I am really surprised that I could not find the answer to
this question: I did find out how my VBA code could add
controls to sheet, so I expect that it should also be
possible to have you macro add the event code for these
controls.

Thanks for any suggestions

Hans Bergman
Ottawa, Canada

Chip Pearson

Add event code through a macro
 
Hans,

You can modify VBA code using VBA code. See www.cpearson.com/excel/vbe.htm
for examples.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Hans Bergman" wrote in message
...

My VBA code creates new sheets. I want my VBA code to add
event code for the newly created sheet. Any idea how?

I am really surprised that I could not find the answer to
this question: I did find out how my VBA code could add
controls to sheet, so I expect that it should also be
possible to have you macro add the event code for these
controls.

Thanks for any suggestions

Hans Bergman
Ottawa, Canada





All times are GMT +1. The time now is 01:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com