Combo box with a selection

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 09:19 PM GMT


QUESTION: I'm using VBA in Excel 2007. I have a form that has a combo box which is populated with a few items. Whwn the form is displayed, I want the combo box to come up with one of the items out of the list selected in it (as if user has made a selection from the drop down list). How can I do that? ANSWER: Sanjay

The following line on code in the initialize procedure for the userform that contains combobox1 should put a value in the combobox.

ComboBox1.Value = "b"

---------- FOLLOW-UP ----------




If combobox1 is on userform1, when it initializes it will be set to the third item in the list with the following code:

Private Sub UserForm_Initialize()

   ComboBox1.ListIndex = 2

End Sub

The first item in the combobox is listindex 0.


©2024 eLuminary LLC. All rights reserved.