Run Macro when Worksheet is changed...

M

MOC835

I have a macro defined that I want to run when the worksheet is
changed. (either new data entered or existing data is modified).

2 Questions....
How do I code this macro so it will run automatically when data is
changed or entered?

I have another macro that changes data (when called) in certain
cells. Will this trigger the macro mentioned above? (If not....how
do I make it cascade)
 
D

Dave Peterson

Excel has events that it monitors--like looking for changes made by typing in a
worksheet.

And you can avoid other macros making the event fire by telling excel to stop
listening.

For example:

with worksheets("sheet999")
application.enableevents = false 'stop listening
.range("a1").value = "hi"
application.enableevents = true 'start listening again
end with



Some references:

David McRitchie's intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

You can read more about events at:
Chip Pearson's site:
http://www.cpearson.com/excel/events.htm

David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/event.htm
 

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

Top