Freeze panes

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.
 
J

JLGWhiz

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.
 
D

Dave Peterson

I think that setting that location is one of the rare things where you have to
select the cell first.
 
D

Dave Peterson

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.
 
D

Dave

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top