#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Comboxes

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Comboxes

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


--
Regards,
Tom Ogilvy


"Angeliki" wrote in message
...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to make all checkboxes false and clear all comboxes ynissel Excel Discussion (Misc queries) 5 July 30th 05 12:22 AM


All times are GMT +1. The time now is 01:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"