ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Combo Box List (https://www.excelbanter.com/excel-discussion-misc-queries/48767-combo-box-list.html)

aftamath

Combo Box List
 
This is the code I have for a combo box,

Private Sub ComboBox1_GotFocus()

With ComboBox1
.Text = "Select Dimension"
.AddItem "Weight"
.AddItem "Flange Thickness"
.AddItem "OAL"
.AddItem "Body Length"
.AddItem "Counter Bore"
End With

End Sub

For some reason, the drop down menu lists these five options seven times
over. I'm new to VBA, why is this.

Chip Pearson

You probably want to Clear the combobox before adding items to
it.

.Clear


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"aftamath" wrote in message
...
This is the code I have for a combo box,

Private Sub ComboBox1_GotFocus()

With ComboBox1
.Text = "Select Dimension"
.AddItem "Weight"
.AddItem "Flange Thickness"
.AddItem "OAL"
.AddItem "Body Length"
.AddItem "Counter Bore"
End With

End Sub

For some reason, the drop down menu lists these five options
seven times
over. I'm new to VBA, why is this.




cindee

Chip! Great to see you! I LOVE your website and recommend it often to my
clients! Thanks for just being you!

Cindee

"Chip Pearson" wrote:

You probably want to Clear the combobox before adding items to
it.

.Clear


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"aftamath" wrote in message
...
This is the code I have for a combo box,

Private Sub ComboBox1_GotFocus()

With ComboBox1
.Text = "Select Dimension"
.AddItem "Weight"
.AddItem "Flange Thickness"
.AddItem "OAL"
.AddItem "Body Length"
.AddItem "Counter Bore"
End With

End Sub

For some reason, the drop down menu lists these five options
seven times
over. I'm new to VBA, why is this.






All times are GMT +1. The time now is 06:45 PM.

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