ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create Combobox Visual Basic (https://www.excelbanter.com/excel-programming/334784-create-combobox-visual-basic.html)

Amoni

Create Combobox Visual Basic
 
Hi!

I have a problem with Comboboxes. I need to add combobox to some cells in
excel. And there would have to be some options to select. So to create a
combobox and add options I´m doing this.

Private Sub ComboBox1_Change()
ComboBox1.AddItem "A"
ComboBox1.AddItem "B"
ComboBox1.AddItem "C"
End Sub


The problem is that the options will be added each time I click om the
combomeny. So does any one know how to create a combobox and add a list of
options with Visual Basic code.
I also need to refer a cell to a combobox so it is just allowed to change
the option in that specifed cell and so the combo box should not move from
the cell if someone would try.

Thanx

Bob Phillips[_7_]

Create Combobox Visual Basic
 
You could just clear it each time, a bit simpler than building on the fly.

Combobocx1.Clear

--
HTH

Bob Phillips

"Amoni" wrote in message
...
Hi!

I have a problem with Comboboxes. I need to add combobox to some cells in
excel. And there would have to be some options to select. So to create a
combobox and add options I´m doing this.

Private Sub ComboBox1_Change()
ComboBox1.AddItem "A"
ComboBox1.AddItem "B"
ComboBox1.AddItem "C"
End Sub


The problem is that the options will be added each time I click om the
combomeny. So does any one know how to create a combobox and add a list of
options with Visual Basic code.
I also need to refer a cell to a combobox so it is just allowed to change
the option in that specifed cell and so the combo box should not move from
the cell if someone would try.

Thanx





All times are GMT +1. The time now is 10:24 PM.

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