white_flag
Active Member
- Joined
- Mar 17, 2010
- Messages
- 331
Hello
I have an user form with 10 comboboxes. I like to put an condition that will check all comboboxes and if one of them has some values then to enable some checkboxes. If all are with .ListIndex = -1 then to locked those checkboxes. I have this code but the problem is that wen in Combo1 is empty and Combo3 >-1 will act like all combos are empty
I have an user form with 10 comboboxes. I like to put an condition that will check all comboboxes and if one of them has some values then to enable some checkboxes. If all are with .ListIndex = -1 then to locked those checkboxes. I have this code but the problem is that wen in Combo1 is empty and Combo3 >-1 will act like all combos are empty
Code:
Sub freez_cc()
For i = 1 To 10
If Me.Controls("ComboBox" & i).ListIndex = -1 Then
Me.Controls("CheckboxA26").Locked = True
Me.Controls("CheckboxA26").Value = False
Me.Controls("Checkbox14").Locked = True
Me.Controls("Checkbox14").Value = False
Me.Controls("Checkbox16").Locked = True
Me.Controls("Checkbox16").Value = False
Me.Controls("Checkbox17").Locked = True
Me.Controls("Checkbox17").Value = False
Me.Controls("Checkbox20").Locked = True
Me.Controls("Checkbox20").Value = False
Else
Me.Controls("CheckboxA26").Locked = False
Me.Controls("Checkbox14").Locked = False
Me.Controls("Checkbox16").Locked = False
Me.Controls("Checkbox17").Locked = False
Me.Controls("Checkbox20").Locked = False
Exit For
End If
Next
End Sub