Under the Freeze panes, Excel currently offers Freeze panes, Freeze first row and Freeze first column options.
I was looking for an option where I can freeze the first N-columns.
I did a record macro to find out what Excel was doing when Freeze first column option was selected and it showed this:

Sub Macro1()
' Macro1 Macro
    With ActiveWindow
        .SplitColumn = 1
        .SplitRow = 0
    End With
    ActiveWindow.FreezePanes = True
End Sub

But what actually is happening is a split column than the freeze pane function.

So when I changed the .SplitColumn=4, I ended having a split than freeze panes.

Is there a workaround for this or is this suppose to work only this way?


This is an interesting question, and I can see your question is actually 2 parts.

  1. Why does the macro choose Split instead of Pane and
  2. How to work around it.

I don't know the answer to 1, so I'll focus on 2 only.

Since you want to unfreeze you need to use freeze!

Sub DoThis()

    ActiveWindow.FreezePanes = True

End Sub
  • To answer your question why you use split if you want it to behave like freeze - that's how the macro recorder records it... Thanks. It works. But my real question is not answered. How can I initiate a chat with you? – Prasanna Aug 27 '15 at 9:49
  • So the macro recorder does SPLIT window instead of Columns("E:E").Select... That's where everything goes wrong – Prasanna Aug 27 '15 at 9:54
  • Oh I see. Your question isn't WHY the macro chooses to use split instead of Freeze? – Dave Aug 27 '15 at 10:00
  • 1
    Yes. But never mind. I was told that macro recorder is not the perfect action-to-code generating tool.... – Prasanna Aug 27 '15 at 10:08

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.