You can either use the AddItem method or the listfillrange property
Combobox1.listfillrange = "A1:A10"
Or
For 1 = 1 to 10
Combobox1.additem sheets("Sheet1".cells(i,1).text
next i
I don't mean to be rude but this is a very basic question that can be answered easily by using either the VBA help files or the object model
just type "combobox" into the answer wizard or in the VBE, press F2 to bring up the object model and enter combobox into the search engine - you get a complete list of all methods and properties in there - all with a link to their "help" pages
Rgds, Geoff [blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
I am new to using forms with vba and I spent several hours yesterday trying to get something to work. The listfillrange property method never worked and it always errored on me. I did look in help but due to my lack of knowledge with forms let alone VBA, I decided to post the question. I had initially hardcoded the add items:
Code:
.AddItem "01 - Jan 04"
.AddItem "01 - Feb 04"
etc...
but I needed an easier way for the end user to change for the following year..without going into VBA and changing the code...Hence loading data from a sheet in excel.
Apologies for asking a simple question...
Have a star as your second suggestion worked. Thankyou.
Please don't apologise for asking a "simple" question.I mentioned the help files and object model as I thought it might help out if you have another, similar issue. I hope you were not offended as no offense was meant.
The listfillrange probably needs a Sheet as well so
Listfillrange = "Sheet1!A1:A10"
should work for future reference
Rgds, Geoff [blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.