Show Tabs by date
There are a couple different ways you could do this. I chose to use
an array of month names that correlate with the sheet names. This
will allow any sheets that are stuck inbetween months to not be
hidden. Edit this as you see fit.
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
MsgBox "No months to hide"
Else
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
Tasha wrote:
Is there a way to create a macro that will show the tabs at the bottom by the
current month? I have the tabs named by month, and only want it to show
January-Current month tabs only as it progresses through the year. So, for
instance, Tabs January, February, March, etc.... through September would be
showing right now, then next month, would include October.
|