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
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

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
 

Watch MrExcel Video

Forum statistics

Threads
1,113,992
Messages
5,545,373
Members
410,679
Latest member
rolandbianco
Top