ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   combo box selection disappearance (https://www.excelbanter.com/excel-programming/278718-combo-box-selection-disappearance.html)

chris[_7_]

combo box selection disappearance
 
Okay, to put as much detail as I can because this problem
is really
bugging.

1.)in a basic excel sheet I went into view, toolbar, and
created a number
of combo boxes on a sheet. No form created.

2.)I wrote in the code ( Worksheet_SelectionChange):

Me.CSQC.Clear
Me.CSQC.AddItem ""
Me.CSQC.AddItem "Michelle McGee"
Me.CSQC.AddItem "Ted Herrera"
Me.CSQC.AddItem "Don Anderson"
Me.CSQC.AddItem "Ed MaaRouf"
Me.CSQC.AddItem "Traci Willman"
Me.CSQC.AddItem "Lori Bottom"
Me.CSQC.AddItem "John A. Anderson"
Me.CSQC.AddItem "Tim Crull"

just an example of each combo box.

3.) now the user can select on of these choices. Let's
say I pick michelle
and then I click into a cell somewhere in the sheet. The
selection
disappears! I can't figure out why.

please help. I got a feeling that it has to do with
Worksheet_SelectionChange but since we are dealing with a
sheet. would the
above code go into activate or what?

thank you.


Dianne

combo box selection disappearance
 
Chris,

Try putting your code in the Worksheet_Activate event instead of the
SelectionChange event.

The SelectionChange event fires when you select a different cell on your
worksheet -- it doesn't refer to the combobox selection.

The problem is that each time you select another cell on your worksheet,
your code runs -- this code includes a Clear, so it wipes out anything
you've picked on your combobox.

Private Sub Worksheet_Activate()

With Me.CSQC
.Clear
.AddItem "Michelle McGee"
.AddItem "Ted Herrera"
.AddItem "Don Anderson"
.AddItem "Ed MaaRouf"
.AddItem "Traci Willman"
.AddItem "Lori Bottom"
.AddItem "John A. Anderson"
.AddItem "Tim Crull"
End With

End Sub

--
Dianne

In ,
chris typed:
Okay, to put as much detail as I can because this problem
is really
bugging.

1.)in a basic excel sheet I went into view, toolbar, and
created a number
of combo boxes on a sheet. No form created.

2.)I wrote in the code ( Worksheet_SelectionChange):

Me.CSQC.Clear
Me.CSQC.AddItem ""
Me.CSQC.AddItem "Michelle McGee"
Me.CSQC.AddItem "Ted Herrera"
Me.CSQC.AddItem "Don Anderson"
Me.CSQC.AddItem "Ed MaaRouf"
Me.CSQC.AddItem "Traci Willman"
Me.CSQC.AddItem "Lori Bottom"
Me.CSQC.AddItem "John A. Anderson"
Me.CSQC.AddItem "Tim Crull"

just an example of each combo box.

3.) now the user can select on of these choices. Let's
say I pick michelle
and then I click into a cell somewhere in the sheet. The
selection
disappears! I can't figure out why.

please help. I got a feeling that it has to do with
Worksheet_SelectionChange but since we are dealing with a
sheet. would the
above code go into activate or what?

thank you.





All times are GMT +1. The time now is 09:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com