R
ranswert
I have the following code when a worksheet is started and the exited:
Private Sub Worksheet_Activate()
Dim cst As String
Dim xcell As Range
Dim ycell As Range
unprotectsheet
stopautocalc
cst = Sheets("Databases").Range("currentcost")
Set xcell = Range(cst & "tlr")
Set ycell = Range(cst & "brr").Offset(4, 2)
Range(xcell, ycell).Select
Selection.EntireRow.Hidden = False
HideAroundSelection
Application.Goto Reference:=Worksheets("Cost Summary").Range("A1"), _
Scroll:=True
Range("a1").Select
startautocalc
protectsheet
End Sub
Private Sub Worksheet_Deactivate()
Unprotect
stopautocalc
Range("A:A").EntireRow.Hidden = False
startautocalc
protectsheet
End Sub
Sub stopautocalc()
With Application
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
End With
End Sub
Sub startautocalc()
With Application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = xlCalculationAutomatic
End With
End Sub
I would like to make it so that the screen doesn't flash when it was started
and exited. I thought the 'stopautocalc' would work, but it doesn't. Any
ideas on how to stop it from flashing?
Thanks
Private Sub Worksheet_Activate()
Dim cst As String
Dim xcell As Range
Dim ycell As Range
unprotectsheet
stopautocalc
cst = Sheets("Databases").Range("currentcost")
Set xcell = Range(cst & "tlr")
Set ycell = Range(cst & "brr").Offset(4, 2)
Range(xcell, ycell).Select
Selection.EntireRow.Hidden = False
HideAroundSelection
Application.Goto Reference:=Worksheets("Cost Summary").Range("A1"), _
Scroll:=True
Range("a1").Select
startautocalc
protectsheet
End Sub
Private Sub Worksheet_Deactivate()
Unprotect
stopautocalc
Range("A:A").EntireRow.Hidden = False
startautocalc
protectsheet
End Sub
Sub stopautocalc()
With Application
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
End With
End Sub
Sub startautocalc()
With Application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = xlCalculationAutomatic
End With
End Sub
I would like to make it so that the screen doesn't flash when it was started
and exited. I thought the 'stopautocalc' would work, but it doesn't. Any
ideas on how to stop it from flashing?
Thanks