ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   On Open/On Close (https://www.excelbanter.com/excel-programming/300961-open-close.html)

jeff

On Open/On Close
 
I have three sheets: X, Y, & Z. The only sheet I want
visible when first opened or when closed is sheet X. What
would the VBA code look like to accomplish this?

Charles

On Open/On Close
 
Jeff,

You can use

Worksheets("You Sheet").Activate

at the begging of your macro and when you close.


HTH


Charle

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


Anders Silven

On Open/On Close
 
One way, Jeff,

In the code module for ThisWorkbook:

'*****
Option Explicit
Private Sub Workbook_Open()
Dim wks As Worksheet
For Each wks In Me.Worksheets
If wks.Name < "Sheet1" Then wks.Visible = xlSheetHidden
Next
End Sub
'*****

You may enter the same code in Workbook_Close as well, so the sheets will not be
visible if the workbook is opened with macros disabled.-

HTH
Anders Silven


"Jeff" skrev i meddelandet
...
I have three sheets: X, Y, & Z. The only sheet I want
visible when first opened or when closed is sheet X. What
would the VBA code look like to accomplish this?



Bob Phillips[_6_]

On Open/On Close
 
I replied to your earlier post. What was wrong with that suggestion?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Jeff" wrote in message
...
I have three sheets: X, Y, & Z. The only sheet I want
visible when first opened or when closed is sheet X. What
would the VBA code look like to accomplish this?





All times are GMT +1. The time now is 11:28 AM.

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