Unable to reset active x control object Values

learn2vba

New Member
Joined
Jun 11, 2020
Messages
10
I would like to reference this old thread as this is exactly what I am trying to do:


Just reposting what I said in that thread:

Basically, it doesnt seem to work for me. I know the macros work as I tested each of them by creating new objects for each control but the existing ones doesn't get affected for some reason.

The logic I arrived at is maybe because the objects are part of "groups"?

Any assistance is greatly appreciated.

Best Regards,
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Just adding more information:

I have 3 grouped Form control check boxes which I will name as Checkbox_group1, Checkbox_group2 and Checkbox_group3. All of which has 6 to 9 checkboxes.
There are also some other individual checkboxes within the Worksheet.

When I run this macro:

Sub ClearFormsCheckboxes()
Dim chBox As CheckBox

For Each chBox In ActiveSheet.CheckBoxes
If chBox.Value = 1 Then
chBox.Value = 0
End If
Next
End Sub


All individual checkboxes gets unchecked but the ones in groups does not get affected. I still can't figure out why.

Please help.
 
Upvote 0
You in this thread title and in the link, you mentioned ActiveX controls, but in post #3 you speak of Forms controls and groups.
AFAIK, Grouping controls is only for controls for the Forms menu.

Controls from the Forms menu are Shapes and they get their values set through the .ControlFormat property of that shape.
Grouping the controls shouldn't prevent you from addressing them individually.
What control's values do you want reset to what values?
 
Upvote 0
Hello Mike,

Thank you very much for the reply. All my checkboxes are from the Forms menu. I was still thinking of the referred thread when I made my title so I apologize for the confusion.

I need all the checkboxes to be "unchecked" whenever a selection from a combobox option is selected. The macro I posted does not work for the "grouped checkboxes" in the worksheet but works for individual ones.

Also, I need these "grouped checkboxes" due to functional features I added to the Worksheet. So I really need to keep them grouped. Please tell me if you need other information from me. Sorry for the late reply. I am currently working on this project. I'll make sure to keep my eyes glued to this thread.

Thank you in advance!

Best Regards,
 
Upvote 0
Leave them grouped.
Are these CheckBoxes or OptionButtons. Typically, putting a checkbox inside a Group Box.

Are these controls in a Group Box (a seperate item from the Forms Menu) or are they Grouped (selected and the Group option clicked on the Shape Format ribbon
.
 
Upvote 0
They are checkboxes that I've selected individually and grouped via the group option. Some of these have functions when checked if that helps.
 
Upvote 0
This code should uncheck all of the checkboxes in Group 1

VBA Code:
Sub test()
    Dim oneShape As Shape
    
    For Each oneShape In ActiveSheet.Shapes("Group 1").GroupItems
        With oneShape
            If .Type = msoFormControl Then
                If .FormControlType = xlCheckBox Then
                    .ControlFormat.Value = xlOff
                End If
            End If
        End With
    Next oneShape
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,891
Messages
6,122,105
Members
449,066
Latest member
Andyg666

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