Comboxes

  • Thread starter Thread starter Angeliki
  • Start date Start date
A

Angeliki

Hi,
I have a combobox with 3 options. When i choose an option i want to write me
the
option in the cell (6,5). although it works for the second and third option
(Non Residential and combined)
it does not work for the first one (Residential). Here it is my code. Could
you please tell me what is wrong?

If ComboBox3.ListIndex = 0 Then
Worksheets("OUTPUT_CAT").Activate
Cells(6, 5) = "Residential"
End If

If ComboBox3.ListIndex = 1 Then
Worksheets("OUTPUT_CAT").Activate
Cells(6, 5) = "Non Residential"

Else
Worksheets("OUTPUT_CAT").Activate
Cells(6, 5) = "Combined"

End If

Thanks in advamce
Angeliki
 
You first test for zero. So the cell receive Residential or nothing. Then
regardless, you
then test for 1 and if it isn't 1 you treat it as Combined. So residential
is overwritten in this step. Make your checks exclusive so only one action
is performed:

If ComboBox3.ListIndex = 0 Then
Worksheets("OUTPUT_CAT").Activate
Cells(6, 5) = "Residential"
ElseIf ComboBox3.ListIndex = 1 Then
Worksheets("OUTPUT_CAT").Activate
Cells(6, 5) = "Non Residential"

Else
Worksheets("OUTPUT_CAT").Activate
Cells(6, 5) = "Combined"

End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top