ChristineJ
Well-known Member
- Joined
- May 18, 2009
- Messages
- 773
- Office Version
- 365
- Platform
- Windows
I've been using the codes below on buttons to toggle back and forth between a split screen (with scrollbars) and a full screen.
Instead of the buttons and I'd like to change it so that when the file opens it automatically runs the SPLIT SCREEN macro AND when the user closes either of the two screens/panes it automatically runs the FULL SCREEN macro and closes the entire file (whether the user chooses to save or not). Can someone help with this?
FULL SCREEN
SPLIT SCREEN
Instead of the buttons and I'd like to change it so that when the file opens it automatically runs the SPLIT SCREEN macro AND when the user closes either of the two screens/panes it automatically runs the FULL SCREEN macro and closes the entire file (whether the user chooses to save or not). Can someone help with this?
FULL SCREEN
Code:
Sub FullScreen()
Application.ScreenUpdating = False
ActiveWindow.Close
ActiveWindow.WindowState = xlMaximized
Application.Goto Range("A1")
End Sub
SPLIT SCREEN
Code:
Sub SplitScreen()
Application.ScreenUpdating = False
Dim wd As Double, ht As Double
wd = Application.UsableWidth
ht = Application.UsableHeight
With ActiveWindow
.WindowState = xlNormal
.Left = 0
.Top = 0
.Width = wd * 1 / 2
.Height = ht
Application.Goto Range("A1"), Scroll:=True
End With
With ActiveWindow.NewWindow
.Left = wd * 1 / 2
.Top = 0
.Width = wd * 1 / 2
.Height = ht
Application.Goto Range("AA1"), Scroll:=True
End With
Application.ScreenUpdating = True
End Sub
Last edited: