ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add code to a worksheet programatically (https://www.excelbanter.com/excel-programming/347775-add-code-worksheet-programatically.html)

Dave B[_9_]

Add code to a worksheet programatically
 
I rarely have to post questions anymore because the use group history
has an answer for just about any question you can think of. But here's
one that I need help on. I have a workbook I call "Master.xls" with
VBA code which opens & manipulates several other workbooks. One of the
things I would like to do in each of the other books is add a
Worksheet_Change event to sheets in the workbooks. There are hundreds
of them so doing it manually isn't really an option. How can I use VBA
to add code to a worksheet module in another open workbook? Thanks a
lot gurus.


Dave B[_9_]

Add code to a worksheet programatically
 
e.g. let's say the code was:

Sub Worksheet_Change(ByVal Target As Excel.Range)
MsgBox Target
End Sub

(although it's much longer than that)


Chip Pearson

Add code to a worksheet programatically
 
See www.cpearson.com/excel/vbe.htm for details and examples.


"Dave B" wrote in message
oups.com...
I rarely have to post questions anymore because the use group
history
has an answer for just about any question you can think of.
But here's
one that I need help on. I have a workbook I call "Master.xls"
with
VBA code which opens & manipulates several other workbooks.
One of the
things I would like to do in each of the other books is add a
Worksheet_Change event to sheets in the workbooks. There are
hundreds
of them so doing it manually isn't really an option. How can I
use VBA
to add code to a worksheet module in another open workbook?
Thanks a
lot gurus.





All times are GMT +1. The time now is 05:27 PM.

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