Several Toggle Buttons that conflict on De-selection

CStallion

New Member
Joined
Oct 28, 2011
Messages
4
Hi all,

Using Excel 2003 VB
Currently I have 3 toggle buttons which, independantly, on selection hide a set of columns and se-selection unhide the same set ofcolumns (not Unhide all). On selection of 2 or all 3 buttons thier associated sets of columns hide, thus if all 3 buttons are selected together I have very few visible columns.

The issue occurs when I de-select the buttons because some of the associated sets of columns overlap each other. therefore when I de-select a button, it unhides its associated columns even the columns selected to be hidden by a selected button.

Is it possible to, on de-selection of a toggle button, get it to check what other toggle buttons are selected and essentially re-run their macros
OR
only unhide the columns not associated to another button in its selected condition?

Many Thanks
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Thanks Andrerw
This is the code for one of the buttons, it is the same for the other buttons apart from the range ("A6:CZ6"), which is just a different line.


Private Sub ToggleButtonAPI6_Click()
If ToggleButtonAPI6 = True Then
Application.ScreenUpdating = False
ToggleButtonAPI6.ForeColor = vbRed
Application.ScreenUpdating = True
For Each Cl In Range("A6:CZ6")
If Cl.Value = "API06" Then
Columns(Cl.Column).Hidden = True
End If
Next
For Each Cl In Range("F20:F500")
If Cl.Value = "New Scheme" Then
Rows(Cl.Row).Hidden = True
End If
Next
End If
If ToggleButtonAPI6 = False Then
Application.ScreenUpdating = False
ToggleButtonAPI6.ForeColor = vbBlack
For Each Cl In Range("A6:CZ6")
If Cl.Value = "API06" Then
Columns(Cl.Column).Hidden = False
End If
Next
Range("F20:G500").EntireRow.Hidden = False
Exit Sub
End If
End Sub
 
Upvote 0
Fogive me, still new at this. where would I insert / replace with the code you suggested?

Thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,178
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top