Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Loading Data into ListBox

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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Loading Data into ListBox

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....
wrote in message
ups.com...
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 '<==== Listbox1 ??
.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?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Loading Data into ListBox

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

wrote in message
ups.com...
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?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Loading Data into ListBox

On Feb 1, 1:32 pm, "NickHK" wrote:
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

wrote in message

ups.com...



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?- Hide quoted text -


- Show quoted text -


Sweet! that did the trick, thanks alot

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
loading data into a listbox faster David Excel Programming 6 September 17th 06 05:29 PM
Loading data into Excel file from Data table. [email protected] Excel Programming 0 August 12th 06 12:17 AM
loading data from access in vba Remy New Users to Excel 2 July 18th 06 06:35 PM
Loading Column Data with blank Rows into Data Validation Box ExcelMonkey Excel Worksheet Functions 3 October 13th 05 06:09 PM
Loading Data from File ~~!!~~ Iceage Excel Programming 0 November 24th 04 01:39 AM


All times are GMT +1. The time now is 03:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"