Try the attached example. When you create the listbox on the worksheet, it should
have MultiSelect option = 1 and ListStyle = 1.
You should find, in the attached file, that the five worksheets named "Monday" through "Friday" start out
visible, and are hidden when you uncheck each day-name in the list box.
Here is the code. In the worksheet module, and I used "Sheet1" for this:
Private Sub ListBox1_Change()
If flag Then Exit Sub
Sheets(ListBox1.List(ListBox1.ListIndex)).Visible = _
ListBox1.Selected(ListBox1.ListIndex)
End Sub
then create a new module and add this code:
Public flag As Boolean
Private Sub Auto_Open()
Dim j As Integer
With Sheets("Sheet1")
.ListBox1.AddItem "Monday"
.ListBox1.AddItem "Tuesday"
.ListBox1.AddItem "Wednesday"
.ListBox1.AddItem "Thursday"
.ListBox1.AddItem "Friday"
flag = True
For j = 0 To .ListBox1.ListCount - 1
Sheets(.ListBox1.List(j)).Visible = True
.ListBox1.Selected(j) = True
Next
flag = False
End With
End Sub
Bookmarks