PDA

View Full Version : Solved: ComboBox Query



Derek
11-07-2005, 10:09 AM
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
:help

Killian
11-07-2005, 10:48 AM
use the checkbox_change event to set the index value for the comboboxIf CheckBox1.Value = True Then
ComboBox1.ListIndex = 0
End IfYou might also want to set its Enabled property to False as well so users can't change it while No is ticked.

Derek
11-07-2005, 11:03 AM
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
:dunno

ALe
11-07-2005, 11:19 AM
hi derek,

as far as i know the value of listindex of the first row of a list is 0.

ALe
11-07-2005, 11:21 AM
sorry I missed the code. It sholud be:

Private Sub Checkbox11_Click()
If CheckBox10.Value = True Then
ComboBox1.ListIndex = 1
End If
End sub

ALe
11-07-2005, 11:21 AM
sorry I missed the code. It sholud be:

Private Sub Checkbox11_Click()
If CheckBox10.Value = True Then
ComboBox1.ListIndex = 0
End If
End sub

Derek
11-07-2005, 11:37 AM
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

ALe
11-08-2005, 01:31 AM
can you post a sample file?

Derek
11-08-2005, 01:55 AM
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?"

ALe
11-08-2005, 03:08 AM
change the checkbox event this way
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

Derek
11-08-2005, 03:53 AM
Superb, Ale. Thank You. :beerchug:

ALe
11-08-2005, 03:58 AM
Good. I'm happy to help. Bye