Freeze panes

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

Hi,
I used the macro recorder when freezing panes, and it returned the following:

Range("A8").Select
ActiveWindow.FreezePanes = True

Is there a VBA way to tell Excel where to freeze, without selecting the cell?
eg: ActiveWindow.FreezePanes, Range("A8")
The above example errors, but is there a syntax for this?

Regards - Dave.
 
You would have to use the Split property in conjunction with the FreezePanes
property. See the VBA help file for Freeze Panes and Split for more details.
 
I think that setting that location is one of the rare things where you have to
select the cell first.
 
ps.

I'll use:

with worksheets("somesheetname")
.select
.range("A1").select 'to make sure it's visible
.range("a8").select 'to position for the freezepanes
activewindow.freezepanes
end with

Otherwise, I may not see all the header rows.
 
Thanks Dave.
I've found freeze panes a bit of a pain in other ways too, such as cutting
off comments from cells in the frozen part of the sheet.
eg, freeze Column A, then write a comment into A1, then scroll a few columns
across, then try to read the comment in A1.
Regards - Dave.
 
Back
Top