ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Forms Combo Box Listindex set to zero (https://www.excelbanter.com/excel-programming/401794-forms-combo-box-listindex-set-zero.html)

[email protected]

Forms Combo Box Listindex set to zero
 
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

The Dude

Forms Combo Box Listindex set to zero
 
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




" wrote:

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


[email protected]

Forms Combo Box Listindex set to zero
 
On Nov 28, 10:29 am, The Dude
wrote:
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



" wrote:
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


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

The Dude

Forms Combo Box Listindex set to zero
 
That would be more something like userform1.combobox1

" wrote:

On Nov 28, 10:29 am, The Dude
wrote:
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



" wrote:
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


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



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

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