Hi all
I have the following code, (there are multiple different options for Cell c15, which change the size of the screen based on the contents. However, the screen refreshes every time a value is entered. Is there a way, that upon changing the value in c15, it will update to the correct size, but then will not refresh/recalculate until a value is put in cell c22. (Two different examples of the code given, with the different sizes
I have the following code, (there are multiple different options for Cell c15, which change the size of the screen based on the contents. However, the screen refreshes every time a value is entered. Is there a way, that upon changing the value in c15, it will update to the correct size, but then will not refresh/recalculate until a value is put in cell c22. (Two different examples of the code given, with the different sizes
Code:
If Range("C15").Value = "AAAAA" Then
Rows("18:19").EntireRow.Hidden = False
ActiveWindow.Zoom = 80
ActiveWindow.Zoom = 80
iDesiredWidth = 660
iDesiredHeight = 400
With Application
.WindowState = xlMaximized
iMaxWidth = Application.Width
iMaxHeight = Application.Height
' Adjust for starting point
iMaxWidth = iMaxWidth - iStartX
iMaxHeight = iMaxHeight - iStartY
If iDesiredWidth > iMaxWidth Then
iDesiredWidth = iMaxWidth
End If
If iDesiredHeight > iMaxHeight Then
iDesiredHeight = iMaxHeight
End If
.WindowState = xlNormal
.Width = iDesiredWidth
.Height = iDesiredHeight
End With
Code:
If Range("C15").Value = "BBBBB" Then
Application.ScreenUpdating = False
Rows("19").EntireRow.Hidden = True
Rows("18").EntireRow.Hidden = False
ActiveWindow.Zoom = 80
ActiveWindow.Zoom = 80
iDesiredWidth = 620
iDesiredHeight = 380
With Application
.WindowState = xlMaximized
iMaxWidth = Application.Width
iMaxHeight = Application.Height
' Adjust for starting point
iMaxWidth = iMaxWidth - iStartX
iMaxHeight = iMaxHeight - iStartY
If iDesiredWidth > iMaxWidth Then
iDesiredWidth = iMaxWidth
End If
If iDesiredHeight > iMaxHeight Then
iDesiredHeight = iMaxHeight
End If
.WindowState = xlNormal
.Width = iDesiredWidth
.Height = iDesiredHeight
End With
End If