Basic Combobox Usage Question

rootdown42

Board Regular
Joined
Jun 8, 2005
Messages
93
I know this is a farily simple question, but I'm afraid I'm still quite a novice when it comes to VB.

My goal is to create a drop-down box with values that will contain the headers for each column in my data set. When one of the values in the combobox is selected, the data set will be sorted by that value. Whether its sorted ascending or descending depends on that particular column of data. The data set, including headers, is a range from B7:S500.

I assume that I should use a combobox for this task. Couple of questions:

1) Should I use combobox from the Control Toolbox toolbar or the Forms toolbar. What's the difference between the two?

2) Should I use the Select Case construct to perform the sort after a value has been selected from the combobox? If so, what would the test expression be?

Sorry for such basic questions, but any help is appreciated.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Each works differently:

If Column: A contains Item Numbers And
Cloumn: B contains the Item descriptions, has the Range Name "List" then:

if the ComboBox is made with View|Toolbars|ControlToolBox -- then linked cell selects the actual item from the list, and the correct formula to use is:

=VLOOKUP(LinkedCell,List,2,0)

if the ComboBox is made with View|Toolbars|Forms -- then the linked cell selects the index_number of the item, and the correct formula to use is:

=INDEX(List,index_number,2)


Both the formulas and the VB code is different for each type. The box's sit on top of your sheet so it is hard to place them in cells, I use In-Cell-Dropdown lists from the Toolbar:

Data - Validation...
Settings [Tab]: Allow=List, Source=Items by comma or Range or RangeName, Like:

1,2,3
=F1:F8
=myList
 
Upvote 0

Forum statistics

Threads
1,215,779
Messages
6,126,843
Members
449,343
Latest member
DEWS2031

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top