Thanks for your help Bernie. I am fairly new at writing macros and
appreciate your input.
I typed in the code you provided below, but not sure if I have to do
something special to get it to "run". Below is everything in my
"Thisworkbook" section of the macro window (the code you provided me is at
the bottom). Maybe I was supposed to put your code somewhere else I am not
aware of. Please advise.
Macros:
___________________________________________
Sub HideSheets()
'
' HideSheets Macro
'
'
Sheets("Client1").Visible = False
Sheets("Client2").Visible = False
Sheets("Client3").Visible = False
Sheets("Client4").Visible = False
Sheets("Client5").Visible = False
Sheets("Client6").Visible = False
End Sub
Sub ShowMonday()
'
' ShowMonday Macro
'
'
Sheets("Client1").Visible = True
Sheets("Client2").Visible = True
Sheets("Monday").Select
End Sub
Sub ShowTuesday()
'
' ShowTuesday Macro
'
'
Sheets("Client3").Visible = True
Sheets("Client4").Visible = True
Sheets("Tuesday").Select
End Sub
Sub ShowWednesday()
'
' ShowWednesday Macro
'
'
Sheets("Client5").Visible = True
Sheets("Client6").Visible = True
Sheets("Wednesday").Select
End Sub
Sub SortBy()
'
' SortBy Macro
' Main Sorting Macro
'
Dim Message, TitlebarTxt, DefaultTxt, SortVal, YNAnswer As String
' Assigning message text:
Message = _
"Enter a number to show that days groups:" & _
vbCrLf & _
" 1 -- Monday" & vbCrLf & _
" 2 -- Tuesday" & vbCrLf & _
" 3 -- Wednesday"
TitlebarTxt = "Show which day's groups"
DefaultTxt = "Enter 1, 2 or 3"
SortVal = InputBox(Message, TitlebarTxt, DefaultTxt)
Select Case SortVal
Case "1"
Call ShowMonday
Call ShowTuesday
Call ShowWednesday
Call HideSheets
Call ShowMonday
Case "2"
Call ShowMonday
Call ShowTuesday
Call ShowWednesday
Call HideSheets
Call ShowTuesday
Case "3"
Call ShowMonday
Call ShowTuesday
Call ShowWednesday
Call HideSheets
Call ShowWednesday
Case Else
YNAnswer = MsgBox("You didn't enter a valid number. Try again?", vbYesNo)
If YNAnswer = 6 Then
Call SortBy
End If
End Select
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim myS As Workbook
If Sh.Name Like "Client*" Then Exit Sub
For Each myS In Worksheets
If myS.Name Like "Client*" Then myS.Visible = xlSheetHidden
Next myS
If Sh.Name = "Monday" Then
Worksheets("Client1").Visible = xlSheetVisible
Worksheets("Client2").Visible = xlSheetVisible
ElseIf Sh.Name = "Tuesday" Then
Worksheets("Client3").Visible = xlSheetVisible
Worksheets("Client4").Visible = xlSheetVisible
ElseIf Sh.Name = "Wednesday" Then
Worksheets("Client5").Visible = xlSheetVisible
Worksheets("Client6").Visible = xlSheetVisible
End If
End Sub
__________________________________________________________