Can I have two worksheet_change events in same worksheet?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Can I have two worksheet_change procedures within the same worksheet code
window? If so, how do I differentiate between the two procedures without
there being a conflict? Upon enacting one of the worksheet_change events, I
have the message that there has been an ambiguous naming conflict in my code.

Thanks,
 
Kent,

there can only be one worksheet_change event procedure for each worksheet.
 
You cannot have two Worksheet_Change events. Rahter, the separate task
should be place within the same procedure, and IF-THEN blocks should be used
to allow either, both, or none to run.

Pflugs
 
You can use Select, or If statements to call a different sub procedure
depending on certain conditions.. but they have to be under just one
worksheet_change event procedure.. for example:

Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$A$1":
MsgBox "execute a sub procedure"
Case "$A$2":
MsgBox "execute a different sub procedure"
End Select
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top