Combo box

In this lesson you will learn how to insert combo box to your spreadsheet.

A combo box is a type drop-down list from which you can choose one option. As for the button, you can assign a macro to your Combo Box, which starts after the change of the selected value from the list. But more often Combo Box is filled within data from cells. The data source for the list range is arranged in a single column of cells. The cell link returns the ordinal number of the selected item in the list.

Add a Combo Box to the Worksheet (form controls)

To add a Combo Box on an Excel worksheet first go to the Excel Ribbon. Click Developer > Insert > Combo Box (in the Form Controls section)

Excel Insert Combo Box

Next put the Combo Box in the Sheet.

Excel Combo Box Inserting

Combo Box is inserted.

Excel Combo Box Inserted

Next right-click and go to Format Control.

Excel Combo Box Format Control

Format Object dialog box appears. Go to Control tab.

  • Input range - range of cells which contain values which will apear in your Combo Box
  • Cell link - put here adress of the cell where will apear the number of value from the list. It will help you creating functions of charts based on Combo Box
  • Drop down lines - number of lines in Combo Box - it should be the number of values in list or less 

Format Object

Your Combo Box is ready.

Excel Combo Box

You can use this Combo Box to create dynamic charts or formulas with Excel.

 

Add a Combo Box to the Worksheet (ActiveX controls)

Click on the combo box icon in the "ActiveX Controls" group.

Insert Combo Box

Drag a combo box on your Excel worksheet.

Insert Combo Box in Sheet

To add items to your combo box right click on it (make sure design mode is selected) and click on "View Code".

View Code

You will now see this window

New VBA code

Write the following piece of code between

 

Private Sub
With Sheet1.ComboBox1
.AddItem “Paris”
.AddItem “New York”
.AddItem “London”
End With
End Sub.

After writing the above code you can close the window from the upper right.

Note: If your combo box is located in sheet1 then write "With Sheet1.ComboBox1".If it’s in sheet3 then write "With Sheet3.ComboBox1". You can add as many items as you like using the .AddItem "London"

This is the result

Ready drop-down list

Now suppose you would like to link your combo box to a cell E3 for example. Right click on the combo box (make sure design mode is selected) and select properties. In "linkedCell" write E3.

Properties

That’s it! You have now successfully created a combo box drop down menu.

Combo Box connected with Cell