Activex Option Button to apply the Activex Checkboxes in a given column

Italito

New Member
Joined
Oct 8, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
Hi

I have a spreadsheet with over 200 columns and I want to use VBA to hide selected ones. On a separate worksheet, I have put Activex checkboxes going down in a column next to the column names. This works fine, but what I would like to do is have several columns like this so that I can effectively have different default views for different users and use an option button at the top of each column to select which set of checkboxes are used.

Any help with this would be much appreciated.

Thanks!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
On a separate worksheet, I have put Activex checkboxes going down in a column next to the column names. This works fine, but what I would like to do is have several columns like this so that I can effectively have different default views for different users and use an option button at the top of each column to select which set of checkboxes are used.

What is your current code to hide/unhide the columns?

To determine which option button is selected, try something like this:
VBA Code:
Public Sub Find_Selected_Option_Button()
    
    Dim OLEobj As OLEObject
    Dim selectedOptionButton As OLEObject
    
    For Each OLEobj In ActiveSheet.OLEObjects
        If TypeName(OLEobj.Object) = "OptionButton" Then
            If OLEobj.Object.Value = True Then Set selectedOptionButton = OLEobj
        End If
    Next
    
    MsgBox "Selected: " & selectedOptionButton.Name & " in cell " & selectedOptionButton.TopLeftCell.Address(False, False)

End Sub
Then to determine which set of checkboxes to use you could loop through all the checkboxes and see which have the same column as the selected option button, selectedOptionButton.column
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,927
Members
448,533
Latest member
thietbibeboiwasaco

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