combo box event...

On Sheet1!C2 there is a combo box displaying data from Sheet2!L3:L26.

Q1: How this is built?

Q2: Upon a selection from the combo box at Sheet1!C2, how can I have a message box showing the value of the selected item.

FYI, later I will add codes to this event to perform some other task.


Thank you.

Excel 2013
LVL 34
Mike EghtebasDatabase and Application DeveloperAsked:
Who is Participating?
 
FlysterConnect With a Mentor Commented:
From the developer tab select Insert - Active X Controls - Combobox. Place the combobox where you want. Right-click the combobox and select properties. Under ListFillRange enter "Sheet2!L3:L26" (Without quotes.) Right-click the combobox again and select view code. Enter this:

Private Sub ComboBox1_Change()
Dim msg As String
  msg = MsgBox("Combobox1 value is " & Me.ComboBox1.Value, vbOKOnly)
End Sub

This will give you a messagebox showing what the selected value is. See atrrached.

Flyster
Combobox.xlsm
0
 
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Thank you for the good post.

How, can I add and event to the existing combo box? After a right-click, it doesn't give view code option.

Mike
0
 
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Thank you.

It gives me record macro option with this version of Excel. So, after recording something simple, then with a right click again I choose edit macro to access the event.
0
All Courses

From novice to tech pro — start learning today.