View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
A. Young[_2_] A. Young[_2_] is offline
external usenet poster
 
Posts: 1
Default Very Slow Worksheet Calculation

I have code that runs on activation of a sheet to unprotect it, filter out
zero rows, and reprotect. Since I added this code to the workbook it
calculates very slowly - not only the sheet it runs on, but all sheets. I am
fairly new to use of VBA. See code:

Option Explicit
Private Sub Worksheet_Activate()

'
' Autofilter Macro
'

'
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
ActiveSheet.Unprotect
ActiveSheet.Range("$A$1:$N$74").Autofilter Field:=1, Criteria1:="<0", _
Operator:=xlAnd
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub