ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open workbook with designated sheet (https://www.excelbanter.com/excel-programming/294944-open-workbook-designated-sheet.html)

Jan Nordgreen[_2_]

Open workbook with designated sheet
 
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



Anne Troy[_3_]

Open workbook with designated sheet
 
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

"Jan Nordgreen" wrote in message
...
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





BrianB

Open workbook with designated sheet
 
I suggest you put the code into a Before_Close event instead. (Don'
forget to Save too)

--
Message posted from http://www.ExcelForum.com


Rowan

Open workbook with designated sheet
 
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.

Jan Nordgreen[_2_]

Open workbook with designated sheet
 
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



BrianB

Open workbook with designated sheet
 
<<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.


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 05:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com