I am getting this error code: ""Run-Time Error '1004': Method 'Visible' of Object'_Worksheet' Failed""
When trying to run this code:
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
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 need to be able to open each one with a different button.