Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
listboxs and combo boxes
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
listboxs and combo boxes
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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
listboxs and combo boxes
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. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
listboxs and combo boxes
just use the sort command in Excel. Use the options in the combobox to
specify the sort key. If you mean reorder the data in the listbox as well, then just reload the listbox from the data on the worksheet or if you are using the rowsource, I would think it would update automatically. -- Regards, Tom Ogilvy "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. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
listboxs and combo boxes
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. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
listboxs and combo boxes
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. -- Regards, Tom Ogilvy "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. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
listboxs and combo boxes
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. |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Getting Combo boxes to change options based on other Combo boxes. | New Users to Excel | |||
Combo Boxes | Excel Discussion (Misc queries) | |||
Selecting subsets using combo boxes or list boxes | Excel Discussion (Misc queries) | |||
Questions on combo boxes and list boxes. | New Users to Excel | |||
List boxes/combo boxes | Excel Programming |