Thread: [Solved] Return Freeze panes location
View Single Post
 
Old 09-18-2018, 01:22 PM
trevorc trevorc is offline Windows 7 32bit Office 2013
Competent Performer
 
Join Date: Jan 2017
Posts: 173
trevorc will become famous soon enoughtrevorc will become famous soon enough
Default change the freeze panes location with VBA macro

Turns out it was easy,
Code:
Sub Freeze_Panes() 'button click macro to freeze panes at row 4 and col A or Col H
    If ActiveWindow.SplitRow = 3 And ActiveWindow.SplitColumn = 7 Then
       ActiveWindow.SplitRow = 3
       ActiveWindow.SplitColumn = 0
       ActiveWindow.FreezePanes = True
       ActiveSheet.Shapes("FP").TextFrame.Characters.Text = "Freeze" & vbCrLf & "Pane"
    Else
       ActiveWindow.SplitRow = 3
       ActiveWindow.SplitColumn = 7
       ActiveWindow.FreezePanes = True
       ActiveSheet.Shapes("FP").TextFrame.Characters.Text = "Un-Freze" & vbCrLf & "Pane"
   End If
End Sub
Reply With Quote