Private
Sub
CommandButton1_Click()
Dim
i
As
Integer
For
i = 0
To
Me
.ListBox1.ListCount - 1
If
Me
.ListBox1.Selected(i)
Then
ThisWorkbook.Sheets(
Me
.ListBox1.List(i)).Visible = xlSheetVisible
Else
ThisWorkbook.Sheets(
Me
.ListBox1.List(i)).Visible = xlSheetHidden
End
If
Next
i
Unload
Me
End
Sub
Private
Sub
UserForm_Activate()
Dim
WS
As
Worksheet, i
As
Integer
Me
.ListBox1.Clear
For
Each
WS
In
ThisWorkbook.Worksheets
Me
.ListBox1.AddItem WS.Name
Next
WS
For
i = 0
To
Me
.ListBox1.ListCount - 1
If
ThisWorkbook.Sheets(
Me
.ListBox1.List(i)).Visible = xlSheetVisible
Then
Me
.ListBox1.Selected(i) =
True
End
If
Next
i
End
Sub