VBA: Freeze Panes

January 3rd, 2005 | Categories: VBA | Tags: , ,

I recently posted on Freezing panes in Excel, here’s how you can do it using VBA:

Freeze Rows

ActiveWindow.FreezePanes = True

Freeze Columns

ActiveWindow.FreezePanes = True

Freeze Rows and Columns

ActiveWindow.FreezePanes = True

UnFreeze Panes

ActiveWindow.FreezePanes = False
  1. Steve
    June 7th, 2005 at 09:01
    Reply | Quote | #1

    On a worksheet where panes are frozen, and the workbook is scrolled to the right, how do you use VBA to scroll the columns right of the freeze back to their original position, so that all columns are visible from left to right?

  2. Mark
    June 7th, 2005 at 13:00
    Reply | Quote | #2


    The VBA to scroll around is here: VBA: Scroll Vertically and Scroll Horizontally

    I’m guessing that should work for you.


    ActiveWindow.ScrollRow = 1
    ActiveWindow.ScrollColumn = 1

  3. Matt
    September 29th, 2005 at 04:58
    Reply | Quote | #3

    How do you remove the darker spreadsheet lines that show where the frozen panes begin/end? I’d like to do that via vba if possible.


  4. Mark
    October 13th, 2005 at 08:39
    Reply | Quote | #4

    Not sure off the top of my head, may have to hit the newsgroups.