ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   More Then one Worksheet_Change (https://www.excelbanter.com/excel-programming/293144-more-then-one-worksheet_change.html)

pauluk[_7_]

More Then one Worksheet_Change
 
Is it possible to have two or more worksheet_change private subs runnin
on the same spreadsheet

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

More Then one Worksheet_Change
 
No. You can, however, design your single change event to take different
actions based on the cell being changed. The Target argument in the change
event will hold a reference to the cell or cells that triggered the action.
You can set up a case statement or series of if statements to match target
cell to the various cells you want to handle. For example

if not intersect(target,Range("A1:A10")) is nothing then
' changed cell is in the range A1:A10
elseif target.address = "$C$5" then
changed cell is cell C5
elseif . . . and so forth

--
Regards,
Tom Ogilvy


"pauluk " wrote in message
...
Is it possible to have two or more worksheet_change private subs running
on the same spreadsheet?


---
Message posted from http://www.ExcelForum.com/




Beto[_3_]

More Then one Worksheet_Change
 
pauluk < wrote:

Is it possible to have two or more worksheet_change private subs running
on the same spreadsheet?


As I don't know the exact answer, I say try it and see what happens.
Otherwise, I see no need to have different subs if all the changes you
want to control can be controlled from this Event sub. If you don't want
to see a huge Worksheet_Change sub, then create other specific subs in
the sheet module and just call them from the Worksheet_change sub.

Regards,
--
Beto


All times are GMT +1. The time now is 04:56 AM.

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