Worksheet_Change

k209310

Active Member
Joined
Aug 12, 2002
Messages
382
I have a worksheet change function which automatically saves a worksheet every time that a name is entered in to a particular cell.

This function works fine. However every time a run another macro (i have several that gather requested information from databases) the macro again runs i assume due to the worksheet change function.

Is there a way around this little problem?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
At the beginning of your "other macro" put:

Application.EnableEvents = False

and at the end put:

Application.EnableEvents = True
 
Upvote 0
Restrict your change procedure to only run when the particular cell is modified. For example, if you just want the procedure to run when cell A1 is changed, add the following at the start: -

If Target.Address <> "$A$1" Then Exit Sub
' Rest of your code

If your separate macro also modifies the cell, and you don't want the Change event to be triggered, then you could Application.EnableEvents = False at the start of your macro code, but make sure you set it back to True at the end.
 
Upvote 0

Forum statistics

Threads
1,214,847
Messages
6,121,911
Members
449,054
Latest member
luca142

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top