Auto Calc Not Turning Off

Alex O

Active Member
Joined
Mar 16, 2009
Messages
345
Office Version
  1. 365
Platform
  1. Windows
Any ideas why autocalc will not switch to auto? Thanks

Code:
Sub HideRows()With Application
        ScreenUpdating = False 
        Calculation = xlCalculationManual 
        DisplayAlerts = False 
        EnableEvents = False 
    End With
BeginRow = 2
EndRow = 1050
ChkCol = 20
For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value = 1 Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
Else
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
With Application
        ScreenUpdating = False 
        Calculation = xlCalculationManual 
        DisplayAlerts = False 
        EnableEvents = False 
    End With
End If
Next RowCnt
   End Sub
 
Last edited:

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Not sure what all the code is trying to accomplish.... but to address your question, when you use the With block, anything you want to utilize the With must have a "." preceding it:

Code:
Sub HideRows()
With Application
    [B][COLOR="#FF0000"].[/COLOR][/B]ScreenUpdating = False
    [B][COLOR="#FF0000"].[/COLOR][/B]Calculation = xlCalculationManual
    [B][COLOR="#FF0000"].[/COLOR][/B]DisplayAlerts = False
    [B][COLOR="#FF0000"].[/COLOR][/B]EnableEvents = False
End With

BeginRow = 2
EndRow = 1050
ChkCol = 20

For RowCnt = BeginRow To EndRow
    If Cells(RowCnt, ChkCol).Value = 1 Then
        Cells(RowCnt, ChkCol).EntireRow.Hidden = True
    Else
        Cells(RowCnt, ChkCol).EntireRow.Hidden = False
        With Application
            [B][COLOR="#FF0000"].[/COLOR][/B]ScreenUpdating = False
            [B][COLOR="#FF0000"].[/COLOR][/B]Calculation = xlCalculationManual
            [B][COLOR="#FF0000"].[/COLOR][/B]DisplayAlerts = False
            [B][COLOR="#FF0000"].[/COLOR][/B]EnableEvents = False
        End With
    End If
Next RowCnt
End Sub
 
Upvote 0
I completely missed that! Thanks for the help… Much appreciated!
 
Upvote 0
Happy to help - thanks for the feedback. Have a good weekend!
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,692
Members
449,117
Latest member
Aaagu

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