Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Hide specific sheets on closing file

Hi,

little to no knowledge of VBA. I need some script that will automatically
hide sheet x when I close the file. I then want to be able to unhide the
sheet in the normal way when re-opening the file via Format Sheet Unhide.

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Hide specific sheets on closing file

Try:

'=============
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim SH As Worksheet
Set SH = Me.Worksheets("Sheet3") '<<==== CHANGE
SH.Visible = xlSheetHidden
End Sub
'<<=============

This is workbook event code and should be pasted into the workbook's
ThisWorkbook module *not* a standard module or a sheet module:

Right-click the Excel icon on the worksheet
(or the icon to the left of the File menu if your workbook is maximised)
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.

---
Regards,
Norman


"Andy" wrote in message
...
Hi,

little to no knowledge of VBA. I need some script that will automatically
hide sheet x when I close the file. I then want to be able to unhide the
sheet in the normal way when re-opening the file via Format Sheet
Unhide.

Thanks




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Save File to specific location when closing paankadu Excel Discussion (Misc queries) 3 October 26th 09 11:52 PM
how do I hide scroll bars on specific sheets within a workbook AzMan Excel Discussion (Misc queries) 2 October 29th 07 12:36 PM
hide personal.xlsb file without closing Terry Excel Discussion (Misc queries) 3 July 21st 07 07:08 AM
Excel closing event of a specific file m.ahrens Excel Programming 1 December 13th 04 08:54 PM
How Can I hide sheets when closing the app? jose luis Excel Programming 1 September 14th 04 10:59 PM


All times are GMT +1. The time now is 04:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"