A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Add the extra shapes anywhere the existing pair is handled. In this procedure there are only two places: inside the If (when the toggle is “on”) and inside the Else (when the toggle is “off”).
For example, extend the code like this:
Sub Toggle_Info()
With ActiveSheet
If .Shapes("Toggle_Circle_Info").Fill.ForeColor.RGB = RGB(255, 255, 255) Then
'Visibility Info Elements - ON
With .Shapes("Info_Button_Deliveries")
.Visible = True
.Fill.ForeColor.RGB = RGB(255, 255, 255)
End With
.Shapes("Info_Box_Deliveries").Visible = False
With .Shapes("Info_Button_Projects")
.Visible = True
.Fill.ForeColor.RGB = RGB(255, 255, 255)
End With
.Shapes("Info_Box_Projects").Visible = False
With .Shapes("Info_Button_Salaries")
.Visible = True
.Fill.ForeColor.RGB = RGB(255, 255, 255)
End With
.Shapes("Info_Box_Salaries").Visible = False
'Toggle Button Status
Call Change_Toggle_Button_Status( _
.Shapes("Toggle_Circle_Info"), _
.Shapes("Toggle_Background_Info"), _
.Shapes("Toggle_Textbox_Info"), _
True)
Else
'Visibility Info Elements - OFF
.Shapes("Info_Button_Deliveries").Visible = False
.Shapes("Info_Box_Deliveries").Visible = False
.Shapes("Info_Button_Projects").Visible = False
.Shapes("Info_Box_Projects").Visible = False
.Shapes("Info_Button_Salaries").Visible = False
.Shapes("Info_Box_Salaries").Visible = False
'Toggle Button Status
Call Change_Toggle_Button_Status( _
.Shapes("Toggle_Circle_Info"), _
.Shapes("Toggle_Background_Info"), _
.Shapes("Toggle_Textbox_Info"), _
False)
End If
End With
End Sub
Ensure that the shapes on the sheet are actually named Info_Button_Projects, Info_Box_Projects, Info_Button_Salaries, and Info_Box_Salaries (use the Name Box when the shape is selected). The macro can then be assigned to a button or ActiveX control as usual.
References: