More Then one Worksheet_Change

  • Thread starter Thread starter pauluk
  • Start date Start date
P

pauluk

Is it possible to have two or more worksheet_change private subs runnin
on the same spreadsheet
 
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
 
pauluk said:
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,
 
Back
Top