VB Code not executing on Calculate?

andyreloaded

Board Regular
Joined
Aug 1, 2006
Messages
80
For some reason, this code is not executing on Calculate... Anyone have any idea why that might be? All it's doing is applying an auto filter.

Code:
Private Sub Worksheet_Calculate()
   Application.EnableEvents = False
     Range("F9:F375").AutoFilter Field:=1, Criteria1:=">0", Operator:=xlAnd
   Application.EnableEvents = True
End Sub

This is a really cumbersome spreadsheet, and the Calculations take about 20-30 seconds to finish. Would that matter? It used to work flawlessly and all of a sudden now it doesn't execute when the worksheet calculates. The only thing I changed was to expand the amount of lines in the calculation, so that now it takes a bit longer to compute everything on Calculate. Before I made that change it worked, now it doesn't.

Thanks for any insight.

-Andy

EDIT: Added Code tags - Smitty
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
You may be stuck with events off.

Try:

Code:
Sub yada()
  Application.EnableEvents = True
End Sub

To reset it and see if it works.

HTH,

Smitty
 

Forum statistics

Threads
1,141,934
Messages
5,709,417
Members
421,635
Latest member
mehdi hannechi

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
Top