View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Sorting of table depending on a drop-down-list entry

Andreas,

You can't actually sort by an item - you sort by the entire list, and you can only sort ascending or
descending or by a specific order that you create using custom lists.

To do what you want, you would need to add a column of formulas to return a value that will sort the
way that you want. Something like

=IF(B2=$C$1,1,0)

copied down to match your list, where C1 will contain the value from the combobox. Then you could
sort the data table based on that column, in descending order.

But perhaps what you really want is to filter the table to show just the rows where the country
value equals the combo box value.

Of course, the code to do those two different actions differs, so post back with what you actually
want.

HTH,
Bernie
MS Excel MVP


"andreashermle" wrote in message
...
Dear Experts:

I got a drop-down combo box with three entries (DE, EN, ES). As soon
as the user selects one of these entries a table on the same worksheet
has to be sorted by the entry chosen.

Example:
Combobox entries a DE, EN, ES

The list to be sorted has the following make-up

PRODUCT COUNTRY
Item 1 DE
Item 2 ES
Item 3 DE
Item 3 EN
Item 5 ES

Task: as soon as the user selects a value of the drop-down list, the
table (on the same worksheet: A1:B6) is to be sorted by that field
value (using VBA).

Help is much appreciated. Thank you very much in advance.

Regards, Andreas