Hide and Show Excel Sheet Icon Bars

 

These routines can be called by the WorkSheet_Activate and WorkSheet_Deactivate Events

 

Sub Hide_Sheet_IBs()

    Dim strMNames() As String

    Dim intLC1 As Integer

    Dim strSName As String

    Dim errchk

    strMNames = ModNames()

    On Error GoTo Exit_Hide_IBs

    errchk = UBound(strMNames, 1)

    On Error GoTo 0

    For intLC1 = 1 To UBound(strMNames, 1)

        strSName = Right(strMNames(intLC1), Len(strMNames(intLC1)) - 3)

        On Error Resume Next

        Application.CommandBars(strSName).Visible = False

        On Error GoTo 0

    Next intLC1

Exit_Hide_IBs:

End Sub

 

Sub Show_Sheet_IBs()

    Dim strMNames() As String

    Dim intLC1 As Integer

    Dim strSName As String

    Dim strActSName As String

    Dim errchk

    strActSName = ActiveSheet.Name

    strMNames = ModNames()

    On Error GoTo Exit_Show_IBs

    errchk = UBound(strMNames, 1)

    On Error GoTo 0

    For intLC1 = 1 To UBound(strMNames, 1)

        strSName = Right(strMNames(intLC1), Len(strMNames(intLC1)) - 3)

        If strSName = strActSName Then

            Application.CommandBars(strSName).Visible = True

        End If

    Next intLC1

Exit_Show_IBs:

End Sub