Re: Freeze panes in Excel
karhatsu:
=======
This may help you ... there are up to 4 panes in a window.
Code:
Sub PaneTest()
MsgBox (ActiveWindow.Panes(1).VisibleRange.Address)
End Sub
Be warned that if you reference a pane that does not exist (such as Panes(0)), you get an error message:
"Run-time error '1004' Application-defined or object-defined error"
Re: Freeze panes in Excel
You'll also want to check out some other related properties of Windows:
Split, FreezePanes, SplitRow, SplitColumn
Re: Freeze panes in Excel
Here's another helpful hint ...
MsgBox (ActiveWindow.Panes.Count)
Re: Freeze panes in Excel
Excellent, thanks for your help! :thumb: This is what I finally used:
VB Code:
' test if the freeze panes setting is active
Sheets("original").Select
If (ActiveWindow.Panes.Count > 1) Then
' select the freeze panes cell
ActiveWindow.Panes(ActiveWindow.Panes.Count).VisibleRange.Activate
' get the cell range
freezePanesCell = ActiveCell.Address
' set freeze panes in the target sheet
Sheets("target").Select
Range(freezePanesCell).Activate
ActiveWindow.FreezePanes = False ' just in case
ActiveWindow.FreezePanes = True
End If
Re: Freeze panes in Excel
Mostly courtesy of "Definitive Guide to Excel VBA" by Michael Kofler! (a! Apress) Glad it helped you.