Consulting

Results 1 to 9 of 9

Thread: Freeze Pane

  1. #1
    Moderator VBAX Mentor sheeeng's Avatar
    Joined
    May 2005
    Location
    Kuala Lumpur
    Posts
    392
    Location

    Question Freeze Pane

    Hi all,

    Can anyone show me how to use Freeze Pane by Excel macro?

    Thanks.

  2. #2
    VBAX Newbie
    Joined
    Jul 2004
    Posts
    4
    Location
    Hi there:


    Try this.

    Sub Macro1()
    'remove any previous freezing
    ActiveWindow.FreezePanes = False
    'Select the cell you want to start your freezing
    ActiveWorkbook.Sheets("Sheet1").Range("B5").Activate
    'apply freezing
    ActiveWindow.FreezePanes = True
     
    End Sub
    Regards

    Mac

  3. #3
    Moderator VBAX Mentor sheeeng's Avatar
    Joined
    May 2005
    Location
    Kuala Lumpur
    Posts
    392
    Location
    Thanks. macb.
    You had made this thread solved.

    Can we just freeze only vertical or horizontal only?

    Thanks

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by sheeeng
    Thanks. macb.
    You had made this thread solved.

    Can we just freeze only vertical or horizontal only?

    Thanks
    Just selct column A or row 1 for this.

  5. #5
    Moderator VBAX Mentor sheeeng's Avatar
    Joined
    May 2005
    Location
    Kuala Lumpur
    Posts
    392
    Location
    Quote Originally Posted by xld
    Just selct column A or row 1 for this.
    Can show some code example?

    Thx!

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by sheeeng
    Can show some code example?

    Thx!

    Sub Macro1()
    'remove any previous freezing
    ActiveWindow.FreezePanes = False
    'Select the cell you want to start your freezing
    'with no columns frozen
    ActiveWorkbook.Sheets("Sheet1").Range("A5").Activate
    'apply freezing
    ActiveWindow.FreezePanes = True
    End Sub
    
    Sub Macro1()
    'remove any previous freezing
    ActiveWindow.FreezePanes = False
    'Select the cell you want to start your freezing
    'with no rows frozen
    ActiveWorkbook.Sheets("Sheet1").Range("B1").Activate
    'apply freezing
    ActiveWindow.FreezePanes = True
    End Sub

  7. #7
    Moderator VBAX Mentor sheeeng's Avatar
    Joined
    May 2005
    Location
    Kuala Lumpur
    Posts
    392
    Location
    Quote Originally Posted by xld

    Sub Macro1()
    'remove any previous freezing
    ActiveWindow.FreezePanes = False
    'Select the cell you want to start your freezing
    'with no columns frozen
    ActiveWorkbook.Sheets("Sheet1").Range("A5").Activate
    'apply freezing
    ActiveWindow.FreezePanes = True
    End Sub
    
    Sub Macro1()
    'remove any previous freezing
    ActiveWindow.FreezePanes = False
    'Select the cell you want to start your freezing
    'with no rows frozen
    ActiveWorkbook.Sheets("Sheet1").Range("B1").Activate
    'apply freezing
    ActiveWindow.FreezePanes = True
    End Sub
    Thx. Initially I thought that there are no differnces btw above codes.
    But after I run it, I realized that the FreezePane is much depended on location of the cell.

    If the cell is uppermost part of the sheet, it will freeze pane vertically.
    If the cell is leftmost part of the sheet, it will freeze pane horizonly.
    Am I right of these two statements?

    Thanks.

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by sheeeng
    If the cell is uppermost part of the sheet, it will freeze pane vertically.
    If the cell is leftmost part of the sheet, it will freeze pane horizonly.
    Am I right of these two statements?
    That's about right

  9. #9
    Moderator VBAX Mentor sheeeng's Avatar
    Joined
    May 2005
    Location
    Kuala Lumpur
    Posts
    392
    Location
    Thank you, xld.
    You are really a helping hand at this forum.

    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •