Loading Data into ListBox

C

collis47

Ok, ive tried everything i can think of but i just cant get it to
work, i want to load an array of data into a list box when a form
opens.

eg: Private Sub UserForm_initialize()
With ListMonth
..AddItem "July"
..AddItem "August"
..AddItem "September"
..AddItem "October"
..AddItem "Novemebr"
..AddItem "December"
..AddItem "Janurary"
..AddItem "February"
..AddItem "March"
..AddItem "April"
..AddItem "May"
..AddItem "June"
End With
End Sub

but this doesnt seem to work, i can hook the sub up to a button and
make it work, but i just want it to happen on opening the form?

how do i do this?
 
C

Corey

I find it easer to just list the items somewhere out of the road in a
column, and use the :
RowSource= Sheet1!A1:A12
to populate the list.

else check to make sure "LISTMONTH" is the correct List name


Corey....
 
N

NickHK

Works for me.

But you may want to get the VBE to generate the event signatures for you
instead of typing your self, to avoid errors.
Select the component from the left-hand combo box in the Userform's code
window. Then select the event from the right-hand combo box.
In this case "UserForm_initialize" is recognised as "UserForm_Initialize",
so it is OK.

NickHK
 
C

collis47

Works for me.

But you may want to get the VBE to generate the event signatures for you
instead of typing your self, to avoid errors.
Select the component from the left-hand combo box in the Userform's code
window. Then select the event from the right-hand combo box.
In this case "UserForm_initialize" is recognised as "UserForm_Initialize",
so it is OK.

NickHK









- Show quoted text -

Sweet! that did the trick, thanks alot
 

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