Open workbook with designated sheet

J

Jan Nordgreen

I Use winxp and excel2000.

I would like my workbook to always open with the sheet called "panel de
control", so I have tried:

Private Sub Workbook_Open()
Sheets("panel de control").Select
End Sub

It opens with the sheet I was in when I saved the file last time, and then
switches to the sheet "panel de control".

To avoid seeing the sheet I was in when I saved last, I have tried:

Private Sub Workbook_Open()
Application.ScreenUpdating = False
Sheets("panel de control").Select
Application.ScreenUpdating = True
End Sub

That did not improve things.

Any suggestions?

Sincerely,

Jan Nordgreen
 
A

Anne Troy

Try this, Jan (not private); works fine for me:

Sub workbook_open()
Sheets("panel de control").Select
End Sub

<-*-><-*-><-*-><-*-><-*-><-*-><-*-><-*->
Hope this helps!
Anne Troy (better known as Dreamboat)
Author: Dreamboat on Word
Email: Dreamboat*at*Piersontech.com
Web: www.TheOfficeExperts.com
 
B

BrianB

I suggest you put the code into a Before_Close event instead. (Don'
forget to Save too)
 
R

Rowan

Try

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheets("panel de control").Select
End Sub

This will mean that the file is always saved with the required sheet selected and will therefore always open on that sheet.
 
J

Jan Nordgreen

Thanks for the answers.

To put code in beforeclose does not help. When you open a workbook it will
open on the sheet you were on when you last saved it, not when you last
closed it.

To put code in beforesave is not very practical. It would mean that you
would change sheet every time you saved the workbook.

I guess a way to go would be to manipulate the information Excel uses to
determine which worksheet to open, but I don't know how.


Regards,

Jan Nordgreen
 
B

BrianB

<<When you open a workbook it will
open on the sheet you were on when you last saved it>>

That is why I suggested you add a line to save the file.
 
Top