Heres My Code...
So what im trying to do is keep the Union* sheets shown as well as the Report* sheets shown. But i believe i have the code wrong because they are not showing up when the work book opens...
Trim(ws.Name) = "Union*" Or _
Trim(ws.Name) = "Report*" Or _
Thoughts??
Thank you in advance
Code:
Sub HideDatedSheets()
Dim wb As Workbook
Dim ws As Worksheet
Dim dDate As Date
Set wb = ActiveWorkbook
dDate = DateAdd("d", -Weekday(Date) + 1, Date)
For Each ws In wb.Sheets
If Trim(ws.Name) = Format(dDate, "MMM DD, yyyy") Or _
Trim(ws.Name) = Format(dDate + 7, "MMM DD, yyyy") Or _
Trim(ws.Name) = Format(dDate - 7, "MMM DD, yyyy") Or _
Trim(ws.Name) = Format(dDate - 14, "MMM DD, yyyy") Or _
Trim(ws.Name) = Format(dDate - 21, "MMM DD, yyyy") Or _
Trim(ws.Name) = Format(dDate - 28, "MMM DD, yyyy") Or _
Trim(ws.Name) = "Union*" Or _
Trim(ws.Name) = "Report*" Or _
Trim(ws.Name) = "Blank" _
Then ws.Visible = True Else ws.Visible = False
Next
End Sub
So what im trying to do is keep the Union* sheets shown as well as the Report* sheets shown. But i believe i have the code wrong because they are not showing up when the work book opens...
Trim(ws.Name) = "Union*" Or _
Trim(ws.Name) = "Report*" Or _
Thoughts??
Thank you in advance