View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default Very Slow Worksheet Calculation

You can perform calculations on a specific sheet. Found this in the archives;
post from FSt1:

add this to just before the range select
sheets("yoursheetname").activate
Range("A2:P32").Select
this will take you to the desired sheet for the range select.

if you code it like this...
sheets("yoursheetname").range("A2:P32").select
you will get an error - script out of range - if your are not on the
activesheet.
you can only select from the active sheet


HTH,
Ryan---


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"A. Young" wrote:

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