Show Tabs by date
JE, you are correct. That most certainly could happen. But that
could happen with your technique as well, correct?
JE McGimpsey wrote:
Tiny niggle: If the user has manually hidden one or more sheets,
including sheet "Jan", it is possible to get a run-time error with this
technique since at least one sheet must remain visible.
In article . com,
JW wrote:
The prompt is not really necessary. I just put it in for
demonstration purposes.
Sub sheetHider()
Dim mthList As Variant, sht As Worksheet
mthList = Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", _
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
If Month(Date) < 12 Then
For mth = Month(Date) + 1 To 12
For Each sht In ActiveWorkbook.Worksheets
If sht.Name = mthList(mth - 1) Then
sht.Visible = xlSheetHidden
End If
Next sht
Next mth
End If
End Sub
|