Link to home
Start Free TrialLog in
Avatar of sidwelle
sidwelleFlag for United States of America

asked on

freeze panes in excel w/o select

I am using the following lines of code to freeze panes on a sheet, but it has to get focus of the sheet.
Is there anyway to freeze panes w/o activating a current sheet and acting on a selection ?

    Sheets(SheetName).Rows("2:2").Select
    ActiveWindow.FreezePanes = True

Open in new window

Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Why do you need to freeze the panes of a sheet that you are not looking at?
Avatar of sidwelle

ASKER

I plan to look at it as soon as my script is done populating it.
SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I plan to look at it as soon as my script is done populating it.
So do the freezing after that.
I am creating several new sheets via script, don't want to go do it every time for every sheet.
is there anyway of freezing panes w/o using the "ActiveWindow" ?
What object does the "freezepanes" method really belong to ?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the help, all the code seems to be about the same.  I liked Shums solution the best by checking if anything is frozen fist.

Thanks
Thanks for the help, all the code seems to be about the same.  I liked Shums solution the best by checking if anything is frozen fist.

Thanks