-
Solved: ComboBox Query
Derek here for your help again.
I have a checkbox for "yes" and one for "No" answers. If the answer is yes, then there are further variables to be selected from a combobox. If the answer is no then the result must read "None", which is the first option in the list in the same ComboBox. How can I get the ComboBox to read "None" automatically if the "NO" checkbox is ticked?
Derek
-
use the checkbox_change event to set the index value for the combobox[VBA]If CheckBox1.Value = True Then
ComboBox1.ListIndex = 0
End If[/VBA]You might also want to set its Enabled property to False as well so users can't change it while No is ticked.
K :-)
-
Killian
i know I will be proven to be doing something really stupid here but this is what I have used and it does not work. What adjustments should I make?
Private Sub Checkbox11_Click()
If CheckBox10.Value = True Then
ComboBox1.ListIndex = 1
End If
End sub
Thanks
D
-
hi derek,
as far as i know the value of listindex of the first row of a list is 0.
-
sorry I missed the code. It sholud be:
[VBA] Private Sub Checkbox11_Click()
If CheckBox10.Value = True Then
ComboBox1.ListIndex = 1
End If
End sub [/VBA]
-
sorry I missed the code. It sholud be:
[VBA] Private Sub Checkbox11_Click()
If CheckBox10.Value = True Then
ComboBox1.ListIndex = 0
End If
End sub [/VBA]
-
Ale/Killian
This is not working. The answer I want is a the top of the list and is linked to cell A54. Is there an option to amend the list fill range to be just that cell if the "No" checkbox is ticked?
Derek
-
can you post a sample file?
-
Here is the actual file. The comboBox is at the bottom of the page. I wish the display to return "None" when no is clicked to the question "Are you due Insurance Commission?"
-
change the checkbox event this way
[VBA] Private Sub Checkbox10_Click()
Dim RgList As Range
If CheckBox10.Value = True Then
CheckBox9.Value = False
Set RgList = Range(ComboBox1.ListFillRange)
ComboBox1.Value = RgList.Cells(1).Value
Set RgList = Nothing
End If
End Sub [/VBA]
-
Superb, Ale. Thank You.
-
Good. I'm happy to help. Bye
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules