Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default listboxs and combo boxes

populate the listbox (with AddItem)

or

Listbox1.List = TempSheet.Range("A1").CurrentRegion.Value

--
Regards,
Tom Ogilvy

"Dick Kusleika" wrote in message
...
That's a good point, Tom. If, for some reason, you couldn't sort the data
on the worksheet, it would probably still be easier to create a new
worksheet, copy the data, sort it, populate the listbox (with AddItem) and
delete the sheet.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com


Tom Ogilvy wrote:
Dick's links would take a lot of time to adapt to sort an array of more
than two columns. If you are up to the task, drive on, but it would be
easier to sort on the sheet using the built in sort, then grab the whole
range and put it in the list in one step.


"Dick Kusleika" wrote in

message
...
Rich

Here are two options for you to consider. First, put all the

information
from the range in the listbox (you can hide columns you don't want the
user to see by making it's width 0) and populate the textboxes using

the
Column property of the listbox.

Another option is not to use the index to find the other data. You

could
use the Find method, for instance, to find the row that matches the
listbox and populate the textboxes based on that.

Either way, you need to put your data (either 1 column or all columns)
into an array and sort the array before you populate the listbox.

The bonus third option is to sort the range that contains the data

before
you populate the listbox. I don't know if you can do that, however.

To sort a listbox, see here
http://www.dicks-blog.com/excel/2004...g_listbox.html

To sort a multicolumn listbox, see here
http://www.dicks-blog.com/excel/2004...g_a_multi.html

A Find Method example can be seen here
http://www.dicks-blog.com/excel/2004...nd_method.html

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Rich Cooper" wrote in message
...
It is a single column list book. The data is on another worksheet. I
have the list box using a range of nmaes and using the index i am

able
to get the other info about the person and display it in a txtbox. I
just want to know if i can sort the data the same way. Or do i have

to
make it an array. If i make it an array how do i go about doing that.
"Tom Ogilvy" wrote in message
...
You say the listbox has a bunch of names - then you talk about things
like zipcode, state, as so forth. Is this a multicolumn listbox with
all that information for each name?

There is no built in method to sort a listbox's list.

Other than that, you would have to grab the list as an array, sort it
according to your selection in the combobox, then put it back in the
listbox.

What kind of help are you looking for?

--
Regards,
Tom Ogilvy



"Rich Cooper" wrote in message
...
I am working with both a combo box and a list box. The list box has
a bunch of names. The combo box has some options and i want those
options to sort and filter the listbox. How do i do that? Some of
the options are by state, zipcode, city, last nmae, firstname? Any
help wouldbe greatly appreciated.





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
Getting Combo boxes to change options based on other Combo boxes. Ancient Wolf New Users to Excel 1 March 27th 09 06:29 PM
Combo Boxes PerplexedinKY Excel Discussion (Misc queries) 2 August 9th 06 05:49 PM
Selecting subsets using combo boxes or list boxes CLamar Excel Discussion (Misc queries) 0 June 1st 06 07:43 PM
Questions on combo boxes and list boxes. Marc New Users to Excel 1 March 14th 06 09:40 AM
List boxes/combo boxes Tibow Excel Programming 3 February 17th 04 12:35 PM


All times are GMT +1. The time now is 11:05 PM.

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"