Solved

combo box event...

Posted on 2014-04-17
3
247 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 500 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 33

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 33

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

705 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now