Excel - ActiveWindow.FreezePanes
Excel - ActiveWindow.FreezePanes
(OP)
I populate an Excel file with the data from my data base, and often I would like to Freeze Panes so the header will be always visible, even if user scrolls up or down.
What I do is:
That works fine if Sheet(1) is an Active sheet.
But if I place data in Sheet(5) without 'activating' that worksheet, I get an error: 'Object doesn't support this property or method.' Makes sense.
But that happens even if I do Activate this sheet:
So, what would be the way to FreezePanes on Sheets(5)?
What I do is:
CODE
With Sheets(1) .Range("A2").Select .ActiveWindow.FreezePanes = True End With
That works fine if Sheet(1) is an Active sheet.
But if I place data in Sheet(5) without 'activating' that worksheet, I get an error: 'Object doesn't support this property or method.' Makes sense.
But that happens even if I do Activate this sheet:
CODE
With Sheets(5)
.Activate
.Range("A2").Select
.ActiveWindow.FreezePanes = True
End With
So, what would be the way to FreezePanes on Sheets(5)?
---- Andy
"Hmm...they have the internet on computers now"--Homer Simpson
RE: Excel - ActiveWindow.FreezePanes
CODE -->
RE: Excel - ActiveWindow.FreezePanes
CODE
And, turns out, I don't even need Activate
---- Andy
"Hmm...they have the internet on computers now"--Homer Simpson
RE: Excel - ActiveWindow.FreezePanes
I wonder why before we needed to Activate and now not? Haven't used that code in a while so not sure when I'll have a chance to test out removing the Activate at my end.