Split windows : Windows « Application « VBA / Excel / Access / Word






Split windows

 
Sub SplitWindow()
  Dim freezeMode, win As Window
  If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub
  Set win = ActiveWindow
  freezeMode = win.FreezePanes
  win.FreezePanes = False       'else the split cannot be changed
  If win.Split Then win.Split = False: Exit Sub  'cancel split
  win.SplitRow = ActiveCell.Row - win.ScrollRow
  win.SplitColumn = ActiveCell.Column - win.ScrollColumn
  win.FreezePanes = freezeMode   'restore split
End Sub

 








Related examples in the same category

1.How to arrange the windows: as icons (wdIcons, 1) or tiled (wdTiled, 0). The default is wdTiled.
2.Working with the Active Window
3.Arranging and Resizing Windows: ppWindowMaximized, ppWindowMinimized, or ppWindowNormal.
4.Closing a Window
5.transform all windows into icons