Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hiding individual worksheets with code

I have a workbook which contains 40+ sheets that is filled out by our vendors
and returned to us. Not all sheets are used every time and I would like to
hide the unused sheets before submitting to document control.
Every sheet has information on it as there are cell references on each sheet
to basic job information filled out on sheet one.
I was thinking about a macro or VBA that runs behind a hidden command button
that would determine if certain fields on each sheet were filled or empty,
and hide the sheets that had the empty fields.
All of the sheets are protected, so obviously the code would have to
unprotect the sheets before hiding.

I know what end result I would like, but€¦
I have no idea where to start!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Hiding individual worksheets with code

We can start from he-

Sub sonic()
'Scroll through worksheets
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Select
If Range("A1").Value = "" Then ws.Visible = False
Next ws
End Sub

This will loop through all worksheets and hide them if A1 is empty. Two
points. It will fail if A1 is empty in all sheets because you can't hide all
sheets and 2 you don't have to unprotect a protected sheet to hide it.

Mike

"suznal" wrote:

I have a workbook which contains 40+ sheets that is filled out by our vendors
and returned to us. Not all sheets are used every time and I would like to
hide the unused sheets before submitting to document control.
Every sheet has information on it as there are cell references on each sheet
to basic job information filled out on sheet one.
I was thinking about a macro or VBA that runs behind a hidden command button
that would determine if certain fields on each sheet were filled or empty,
and hide the sheets that had the empty fields.
All of the sheets are protected, so obviously the code would have to
unprotect the sheets before hiding.

I know what end result I would like, but€¦
I have no idea where to start!

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
Put data into individual worksheets kjstec New Users to Excel 4 April 14th 09 08:53 PM
Master Worksheets and Individual Worksheets PADutchFireman Excel Worksheet Functions 1 April 2nd 09 05:59 PM
hiding individual characters in Excel Anita Stuever Excel Discussion (Misc queries) 7 May 6th 08 10:02 PM
hiding individual cell values when printing Glen Excel Discussion (Misc queries) 7 July 26th 06 12:03 AM
Answer to Saving worksheets as individual workbooks using code? H.A. de Wilde[_5_] Excel Programming 1 May 4th 06 05:34 PM


All times are GMT +1. The time now is 09:49 AM.

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"