Sub SplitWindow()
Dim freezeMode As Boolean, win As Window
If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub
Set win = ActiveWindow
freezeMode = win.FreezePanes
win.FreezePanes = False
If win.Split Then win.Split = False: Exit Sub
win.SplitRow = ActiveCell.Row - win.ScrollRow
win.SplitColumn = ActiveCell.Column - win.ScrollColumn
win.FreezePanes = freezeMode
End Sub
|