Hi All, I am trying to get my workbook to open to a specific sheet depending on what month it is and automatically hide the rest, I have 12 sheets named after each month i.e january,feburary ect. The code i have manage to scrape up and put together via multiple searches seems to work but creates an error. When i open sheet it opens to january but then creates this error (method "visible" of object'_worksheet failed ) any help would greatly be appreciated see code below. i have this code in the Thisworkbook module
Private Sub Workbook_Open()
Dim ws As Worksheet
Dim oName As Variant
oName = MonthName(Month(Date))
For Each ws In Worksheets
If Format(MonthName(Month(Date)), "MMM") <> "oName" Then ws.Visible = xlSheetHidden
'If Format(Now(), "MMM") <> "oName" Then ws.Visible = xlSheetHidden
'If Not ws.Name = oName Then ws.Visible = xlSheetHidden
Next ws
End Sub
Bookmarks