help with multiple checkboxes/comboboxes

aletnik

New Member
Joined
Apr 7, 2013
Messages
3
hi!! first of all, the forum is awesome!!!!

but right now i'm having some trouble with this and a i wonder if u can help me:

Private Sub UserForm_Initialize()
Dim i, b As Integer
For b = 10 To 18
If Controls("CheckBox" & b).Value = True Then
For i = 1 To 9
Controls("ComboBox" & i).ListIndex = -1
Controls("ComboBox" & i).Enabled = False
Controls("CheckBox" & i).Enabled = False
Controls("CheckBox" & i).Value = False
Next
Else
For i = 1 To 9
Controls("ComboBox" & i).Enabled = True
Next
End If
Next
End Sub

I think u get the ideia of what i want to do, but i can't seem to make the code work.

In need of help!!!!!

Thanks a lot!!!
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
This is a wild guess of what you want. If it's not correct, please provide more detail... a lot more.

Code:
[COLOR=darkblue]Private[/COLOR] [COLOR=darkblue]Sub[/COLOR] UserForm_Initialize()
    [COLOR=darkblue]Dim[/COLOR] b   [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Integer[/COLOR]
    [COLOR=darkblue]For[/COLOR] b = 10 [COLOR=darkblue]To[/COLOR] 18
        [COLOR=darkblue]If[/COLOR] Controls("CheckBox" & b).Value [COLOR=darkblue]Then[/COLOR]
            Controls("ComboBox" & b - 9).ListIndex = -1
            Controls("ComboBox" & b - 9).Enabled = [COLOR=darkblue]False[/COLOR]
            Controls("CheckBox" & b - 9).Enabled = [COLOR=darkblue]False[/COLOR]
            Controls("CheckBox" & b - 9).Value = [COLOR=darkblue]False[/COLOR]
        [COLOR=darkblue]Else[/COLOR]
            Controls("ComboBox" & b - 9).Enabled = [COLOR=darkblue]True[/COLOR]
        [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]
    [COLOR=darkblue]Next[/COLOR]
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]Sub[/COLOR]
 
Upvote 0
first of all thanks!!

i explain: i have 9 comboxes with yes or no possibilities, and i want to have 9 checkboxes (from 10 to 18), that if turned on, i want them, to disable the combox. the ideia it's something like this (the second checkbox doesn't matter):

544829_630346703658656_1360660298_n.jpg


thanks!!!
 
Upvote 0

Forum statistics

Threads
1,203,238
Messages
6,054,313
Members
444,715
Latest member
GlitchHawk

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