Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I Hide VBA excel sheets after saving

How do I return to hidding VBA excel sheets after saving changes to an exel
sheet?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default How do I Hide VBA excel sheets after saving

Are you using xl95?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Burltree" wrote in message
...
How do I return to hidding VBA excel sheets after saving changes to an
exel
sheet?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default How do I Hide VBA excel sheets after saving

Put this in your Workbook BeforeSave Event. This code will loop through a
collection of worksheets that you specify and hide them. Just change the
sheet names to fit your application.

Note: At least one sheet in the workbook must be visible at ALL times or
VBA will throw an error. Plus, do you want the sheets "Hidden" or "Very
Hidden"?

"Hidden" will allow users to unhide work sheets by right clicking the sheets
tabs at the bottom left and selecting the sheet they want to unhide.

"Very Hidden" will only allow the sheet to become unhidden through code
using VBA.

Hope this helps! If so, let me know, click "YES" below.

Option Explicit

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

Dim colSheetsToHide As Collection
Dim wks As Worksheet

' collection of sheets to hide when workbook is saved
Set colSheetsToHide = New Collection
With colSheetsToHide
.Add Sheets("Sheet1")
.Add Sheets("Sheet2")
.Add Sheets("Sheet3")
End With

' hide worksheets in collection
For Each wks In colSheetsToHide
wks.Visible = False
Next wks

End Sub
--
Cheers,
Ryan


"Burltree" wrote:

How do I return to hidding VBA excel sheets after saving changes to an exel
sheet?

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
hide excel sheets Sunil Sagar Excel Programming 3 February 12th 09 04:36 AM
How to hide a macros/functions from excel sheets Bepenfriends Excel Discussion (Misc queries) 1 December 5th 06 06:50 PM
Saving Excel sheets Robin Excel Discussion (Misc queries) 2 February 23rd 05 05:54 PM
How to hide sheets and VBA code in my Excel workbook? John Wilson Excel Programming 0 August 26th 03 04:54 AM
How to hide sheets and VBA code in my Excel workbook? Rick[_13_] Excel Programming 0 August 26th 03 04:01 AM


All times are GMT +1. The time now is 11:44 PM.

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

About Us

"It's about Microsoft Excel"