Forms Combo Box Listindex set to zero

V

vivek.karkun

Hello,

I am pretty much a beginnner when it comes to VBA/macro programming in
excel. I am stuck with probably the simplest problem in excel. There
is a form based combo box with all the properties specified using
format control option. I need to find a way to make the listIndex
property of the dropdown combox always set to 0, the dropdown list
should always begin from the top of the index when clicked on.

Thanks in advance.

Vic
 
T

The Dude

Hi,

If you want your combobox to have the value from the start, insert this code
in the form modules:

Private Sub UserForm_Initialize()
ComboBox1.ListIndex = 0
End Sub
 
V

vivek.karkun

Hi,

If you want your combobox to have the value from the start, insert this code
in the form modules:

Private Sub UserForm_Initialize()
ComboBox1.ListIndex = 0
End Sub

Hello,

Thanks for the reply, however when i use the code snippet i get a Run
time error 424- Object required. I am guessing that ComboBox1 needs to
referenced to get a handle on the ListIndex property. I am using a
Combo Box from the forms toolbar. Putting a Javascript perspective in
place i guess i need to call reference ComboBox1 like this

WorkBook.Worksheet.ComboBox1

Not sure about the syntax.

Thanks again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top