Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

combo box event...

Posted on 2014-04-17
3
Medium Priority
?
275 Views
Last Modified: 2014-04-17
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
0
Comment
Question by:Mike Eghtebas
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
Flyster earned 2000 total points
ID: 40007966
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
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 40007977
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
 
LVL 34

Author Closing Comment

by:Mike Eghtebas
ID: 40007982
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question