A
A. Young
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
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