Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting any changes in an Excel worksheet

Status
Not open for further replies.
Mar 6, 2003
157
JO
Hi,

I created a certain macro. It doesn't matter what it does. However, it takes long to run. Each time a user makes any type of change to the sheet, the macro needs to run.

How would I create a secondary macro to detect any changes made to the worksheet, so that, if no changes were detected, I would like to suppress the running of my main macro?

Thanks,
Shawn
 
Hi,

Whenever a change is made on a sheet, the Worksheet_Change event occurs.

Set a flag in the Workbook_SheetChange event. Then test the flag to see if you need to run your macro. WHat event will trigger this?

Hope this helps :)

Skip,
Skip@TheOfficeExperts.com
 
Hi Skip,

Could you give an example of how I'd be able to use this Workbook_SheetChange function? How would I flag it?


Thanks very much for your reply,
Shawn
 
Hi,

Please keep in mind that I do not want my main macro to run automatically as soon as a change is detected in the worksheet. I am having a user click a menu button to run the macro. Thus, I simply would like to have nothing happen if no changes are made to the sheet when the user clicks on the menu button to run the macro.

I hope this helps.


Regards,
Shawn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top