I am trying to use a sub. Maybe I should do it as a function because I will be calling this many different times.
But for now it's a sub, unless that is why it's not working?
I'm passing two sheet names via macro, to show one sheet, then hide the previous one.
However, I get the error "Expected = "
Code is below, any ideas?
Sub setupToFront()
showsheet ("Status","Setup")
End Sub
Sub showsheet(mySheet As String, Optional ByVal hidesheet As Variant)
Dim ws As Worksheet
Set ws = Worksheets(mySheet)
ws.Visible = xlSheetVisible
ws.Activate
If IsMissing(hidesheet) Then
'nothing, optional val not used
Else
Worksheets(CStr(hidesheet)).Visible = xlSheetHidden
End If
End Sub