Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
RPF2407
 
Posts: n/a
Default How do you "Unhide" multiple sheets at one time?


  #2   Report Post  
Don Guillett
 
Posts: n/a
Default

Use a for/each loop

--
Don Guillett
SalesAid Software

"RPF2407" wrote in message
...



  #3   Report Post  
Gord Dibben
 
Posts: n/a
Default

Sub UnHideAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Visible = True
Next n
Application.ScreenUpdating = True
End Sub


Gord Dibben Excel MVP

On Sat, 25 Dec 2004 13:11:02 -0800, "RPF2407"
wrote:


  #4   Report Post  
KL
 
Posts: n/a
Default

You can also use the following structure to pick sheets one by one:

Sub ProtectSheetsSelected()
Application.ScreenUpdating = False
'You can also use names instead of indeces e.g: "Sheet1".
MyArray = Array(1, 5, 7, 12)
For Each i In MyArray
ThisWorkbook.Sheets(i).Visible=True
Next i
End Sub

Regards,
KL

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Sub UnHideAllSheets()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
Sheets(n).Visible = True
Next n
Application.ScreenUpdating = True
End Sub


Gord Dibben Excel MVP

On Sat, 25 Dec 2004 13:11:02 -0800, "RPF2407"
wrote:




  #5   Report Post  
Vasant Nanavati
 
Posts: n/a
Default

If you want to select the sheets you want to unhide, you have to write your
own macro. Try:

Sub UnhideMultipleSheets()
Dim ws As Worksheet
Dim fHidden As Boolean
On Error GoTo ErrorHandler
fHidden = False
For Each ws In ActiveWorkbook.Worksheets
If ws.Visible = xlSheetHidden Then
fHidden = True
Exit For
End If
Next
If fHidden Then
UnhideSheets.Show
Else
MsgBox "There are no hidden sheets.", vbInformation + vbOKOnly,
"Nothing to unhide!"
End If
Exit Sub
ErrorHandler:
Beep
End Sub

Of course, you will need a UserForm with a ListBox with its MultiSelect
property set to fmMultiSelectExtended, CommandButton1 (OK) and
CommandButton2 (Cancel), and the following code:

Private Sub CommandButton1_Click()
On Error GoTo ErrorHandler
Dim i As Integer
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
ActiveWorkbook.Worksheets(ListBox1.List(i)).Visibl e =
xlSheetVisible
End If
Next
Unload Me
Exit Sub
ErrorHandler:
MsgBox "Sorry; can't be done!"
End Sub

Private Sub CommandButton2_Click()
Unload Me
End Sub

Private Sub ListBox1_Change()
If ListBox1.ListIndex = -1 Then
CommandButton1.Enabled = False
Else
CommandButton1.Enabled = True
End If
End Sub

Private Sub UserForm_Activate()
Dim ws As Worksheet
CommandButton1.Enabled = False
For Each ws In ActiveWorkbook.Worksheets
If ws.Visible = xlSheetHidden Then
ListBox1.AddItem (ws.Name)
End If
Next
End Sub

I may have missed something, so post back if you have a problem.

--

Vasant


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
CHANGE SET-UP ON MULTIPLE SHEETS AT 1 TIME DEMONET48 Excel Discussion (Misc queries) 2 January 14th 05 08:37 PM
HOW CAN I CHANGE SET-UP ON MULTIPLE SHEETS AT 1 TIME? DEMONET48 Setting up and Configuration of Excel 0 January 14th 05 07:53 PM
Excel: Enable UnHiding of multiple sheets at once CyberTaz Excel Discussion (Misc queries) 1 January 13th 05 08:30 PM
Multiple sheets selected twa14 Excel Discussion (Misc queries) 2 December 21st 04 11:15 AM
How do I unhide multiple sheets? ahonig Excel Worksheet Functions 3 December 14th 04 09:03 PM


All times are GMT +1. The time now is 12:19 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"