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

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
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
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,323
Members
449,077
Latest member
jmsotelo

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