For each sheet is giving incorrect result

Hi @jack.chan,

May I know what’s this problem and how to resolve it?

Hello Jack,

It showed “End Sub” pop up message after i changed.

Function unhideSheet(sheetName as string)
    If Not Sheets(sheetName).Visible Then
        Sheets(sheetName).Visible = True
    Else
        Debug.Print "vis"
    End If
End Function

Function hideSheet(sheetName as string)
    If Sheets(sheetName).Visible Then
        Sheets(sheetName).Visible = False
    Else
        Debug.Print "invis"
    End If
End Function