View Full Version : Help with ComboBox In userform
harber95
08-05-2015, 05:22 AM
I would like to know to make a ComboBox that will open up when I click it, that will show me the numbers 1-4 to choose from.
Thanks
JKwan
08-05-2015, 06:05 AM
give this a go
Private Sub UserForm_Initialize()
Me.ComboBox1.List = Array(1, 2, 3, 4)
End Sub
harber95
08-05-2015, 06:18 AM
Thanks. By the way, I don't want the option of writing anything in the combobox when I click it, especially not writing any numbers (4 is the max allowed).
JKwan
08-05-2015, 06:30 AM
I am sorry, I don't understand what you just said.....
Do you want your values to come from a sheet?
harber95
08-05-2015, 07:18 AM
No. When I play the userform, I still have the option to type text in the combo box, and I don't want that.
harber95
08-05-2015, 07:24 AM
Also, how do I make a combo box that its options are text?
(The array action won't work for strings)
JKwan
08-05-2015, 07:41 AM
Well, you can always type into a combobox. I believe that you don't want a combobox, what you want is a listbox. Change it and see if that is what you want
harber95
08-05-2015, 07:59 AM
It's an assignment, and I was specifically told to use combo box. Never mind that.
The next thing I wanted to know is how to make a combo box with text options only.
JKwan
08-05-2015, 08:10 AM
is this what you mean by text options?
Me.ComboBox1.ListStyle = fmListStyleOption
Like I said before, you can always type into a combobox...... Maybe you can lock it with API calls???
JKwan
08-05-2015, 08:14 AM
here ya go
This will only allow listed items to be typed into the combobox
Me.ComboBox1.Style = fmStyleDropDownList
harber95
08-05-2015, 10:08 AM
Thanks
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.