Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Populating a listbox from range xl2003


I have tried numerous examples on how to populate a listbox from a range
and can't get any of them to work. My only guess is that perhaps it is
something different in excel 2003? Maybe I need to change something in
properties?

I'm using the default ListBox1 on a standard userform(Sub
UserForm1_Initialize) and am trying to get a list from
sheets(customers).range("a1:a30")

Any ideas?


--
Ramthebuffs
------------------------------------------------------------------------
Ramthebuffs's Profile: http://www.excelforum.com/member.php...o&userid=16429
View this thread: http://www.excelforum.com/showthread...hreadid=384141

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Populating a listbox from range xl2003


I am assuming the list1 is the name of listbox




Private Sub UserForm_Initialize()

For Each c In Range("a1:a30")
if c.value<"" then
list1.AddItem (c.Value)
end if
Next
End Sub


--
anilsolipuram
------------------------------------------------------------------------
anilsolipuram's Profile: http://www.excelforum.com/member.php...o&userid=16271
View this thread: http://www.excelforum.com/showthread...hreadid=384141

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Populating a listbox from range xl2003


I just found this one line of code to do the work. I'm not sure what
was wrong with every other method I tried. I kept on getting subscript
out of range error.


UserForm1.ListBox1.RowSource = "Customers!A1:a30"

Thanks for the help though.


--
Ramthebuffs
------------------------------------------------------------------------
Ramthebuffs's Profile: http://www.excelforum.com/member.php...o&userid=16429
View this thread: http://www.excelforum.com/showthread...hreadid=384141

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Populating a listbox from range xl2003

Ramthebuffs,

Don't be coy, give us the details <g. It's hard to say without knowing
what you've tried or what used to work for you. This works for me:

Private Sub UserForm_Initialize()
Me.ListBox1.List = Worksheets("customers").Range("A1:A30").Value
End Sub

hth,

Doug

"Ramthebuffs"
wrote in message
...

I have tried numerous examples on how to populate a listbox from a range
and can't get any of them to work. My only guess is that perhaps it is
something different in excel 2003? Maybe I need to change something in
properties?

I'm using the default ListBox1 on a standard userform(Sub
UserForm1_Initialize) and am trying to get a list from
sheets(customers).range("a1:a30")

Any ideas?


--
Ramthebuffs
------------------------------------------------------------------------
Ramthebuffs's Profile:
http://www.excelforum.com/member.php...o&userid=16429
View this thread: http://www.excelforum.com/showthread...hreadid=384141



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Populating a listbox from range xl2003

But how about multiple-columns? does it still works ?





"Doug Glancy" ...
Ramthebuffs,

Don't be coy, give us the details <g. It's hard to say without knowing
what you've tried or what used to work for you. This works for me:

Private Sub UserForm_Initialize()
Me.ListBox1.List = Worksheets("customers").Range("A1:A30").Value
End Sub

hth,

Doug

"Ramthebuffs"
wrote in message
...

I have tried numerous examples on how to populate a listbox from a range
and can't get any of them to work. My only guess is that perhaps it is
something different in excel 2003? Maybe I need to change something in
properties?

I'm using the default ListBox1 on a standard userform(Sub
UserForm1_Initialize) and am trying to get a list from
sheets(customers).range("a1:a30")

Any ideas?


--
Ramthebuffs
------------------------------------------------------------------------
Ramthebuffs's Profile:
http://www.excelforum.com/member.php...o&userid=16429
View this thread:
http://www.excelforum.com/showthread...hreadid=384141







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Populating a listbox from range xl2003


Doug, that one seemed to work also. I think I'll use it actually, it
looks a little more purdy ;-)

I still don't really know what went wrong. Maybe it was just late and
there was some simple answer to the problems I was having. Anyway, I
much prefer 1 line to more.


--
Ramthebuffs
------------------------------------------------------------------------
Ramthebuffs's Profile: http://www.excelforum.com/member.php...o&userid=16429
View this thread: http://www.excelforum.com/showthread...hreadid=384141

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
Populating listbox Mick[_2_] Excel Discussion (Misc queries) 1 May 14th 08 10:48 PM
Populating listbox Andy Brown Excel Programming 3 August 16th 04 05:40 PM
Populating a ListBox ToddG Excel Programming 1 June 24th 04 03:18 AM
Populating combobox/listbox Torstein S. Johnsen[_2_] Excel Programming 1 May 13th 04 09:26 AM
Populating TextBox Value--using ListBox jpendegraft[_15_] Excel Programming 1 May 2nd 04 03:53 AM


All times are GMT +1. The time now is 09:14 AM.

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

About Us

"It's about Microsoft Excel"