PDA

View Full Version : [SOLVED] Freeze Pane



sheeeng
06-27-2005, 11:35 PM
Hi all, :hi:

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

Thanks.

macb
06-27-2005, 11:45 PM
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

sheeeng
06-28-2005, 12:21 AM
Thanks. macb. :thumb
You had made this thread solved. :clap:

Can we just freeze only vertical or horizontal only? :help

Thanks:)

Bob Phillips
06-28-2005, 02:49 AM
Thanks. macb. :thumb
You had made this thread solved. :clap:

Can we just freeze only vertical or horizontal only? :help

Thanks:)

Just selct column A or row 1 for this.

sheeeng
06-28-2005, 09:34 AM
Just selct column A or row 1 for this.

Can show some code example?

Thx! :friends:

Bob Phillips
06-28-2005, 05:44 PM
Can show some code example?

Thx! :friends:



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

sheeeng
06-28-2005, 07:19 PM
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? :doh:

Thanks. :friends:

Bob Phillips
06-29-2005, 12:56 AM
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 :)

sheeeng
06-29-2005, 07:05 PM
Thank you, xld.
You are really a helping hand at this forum.

Thanks again.