I am getting this error code: ""Run-Time Error '1004': Method 'Visible' of Object'_Worksheet' Failed""
When trying to run this code:
Sub SheetDate()
Dim ws As Worksheet
Dim oName As Variant
oName = Format(Date, "mm-dd-yy")
For Each ws In Worksheets
If Not ws.Name = oName Then ws.Visible = xlSheetHidden
Next ws
End Sub
What I am trying to do is have a command button open certain sheets by date. This works but gives me that error code.
And is there a way i can open different sheets by the same date.
I have:
E21 03-14-2015
E22 03-14-2015
E27 03-14-2015
I need to be able to open each one with a different button.
Bookmarks