Worksheet activation on Opening Workbook

R

Raj

Hi,

I have a workbook with two sheets: Sheet1 and Sheet2. Sheet1 has code
for freezing the window panes on cell L2.
On opening the workbook, I want Sheet1 to be activated and the panes
frozen. To achieve this I have included code for
Worksheets("Sheet1").activate in ThisWorkbooks open event.

When the workbook is opened, the Sheet1 is active sheet. However, the
freeze panes does not work. However, when I click Sheet2, followed by
Sheet1, the freeze panes is activated in Sheet1. How can I ensure that
Sheet1 is activated on opening of the workbook.

Thanks in advance for all the help.

Regards,
Raj
 
M

Matthew Pfluger

In addition to activating Sheet1 in the ThisWorkbook module, call the macro
that freezes the panes without relying on the Worksheet_Activate event:

Private Sub Workbook_Open()
Sheets("Sheet1").Activate
' Call the Freeze Panes macro here
End Sub

HTH,
Matthew Pfluger
 
R

Raj

In addition to activating Sheet1 in the ThisWorkbook module, call the macro
that freezes the panes without relying on the Worksheet_Activate event:

Private Sub Workbook_Open()
Sheets("Sheet1").Activate
' Call the Freeze Panes macro here
End Sub

HTH,
Matthew Pfluger

Thanks a ton, Mathhew. That solution worked.
But why was worksheet activation(having freeze panes code) on workbook
opening(having worksheet activation code) not enough to trigger freeze
panes? Any pointers,references or discussions on this kind of events
behaviour most welcome.

Regards,
Raj
 

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