Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Need to open a Message Box from a ComboBox, in Excel 2007

Posted on 2011-09-07
5
Medium Priority
?
234 Views
Last Modified: 2012-06-27
I am trying to write my first VBA function in Excel and do not know how to get the code associated with a given ComboBox. So I thought opening a MessageBox would at least give me confirmation that it was opening correctly.

I already know how to fill a combo box with values.

So, please explain, step by step, how to get to get a given combo box to open a Message Box when a given selection is made on the combo.

Thanks!
0
Comment
Question by:newbieweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 16

Accepted Solution

by:
carsRST earned 2000 total points
ID: 36496632
Private Sub ComboBox1_Change()
    MsgBox "combo change"
End Sub
0
 

Author Comment

by:newbieweb
ID: 36497340
Tahanks. BUt it does not work where I put it, since that's also new to me:)

I use Excel 2007.

1) From the Developer Tab I opened Visual Basic
2) Right clicked the Worksheet
3) Pasted in the code
4) Hit Save

But nowhere do I find how to name the control ComboBox1.

What am I missing??
0
 

Author Closing Comment

by:newbieweb
ID: 36497398
Thanks!  It works!

I neded to let the form generate the full event and need to move the mouse away from the combo box for the message box to open.
0
 
LVL 16

Expert Comment

by:carsRST
ID: 36497414
In design mode, assuming you're using ActiveX, you can just double click your combobox.  That should take you to the change "event" associated with that combobox.  That's where you'll enter your msgbox line.

See the attached file.  Probably obvious but make sure to enable macros.

See the code under sheet1 msgbox.xlsm
0
 
LVL 16

Expert Comment

by:carsRST
ID: 36497419
Oh...sorry.  I guess I should have asked if you were using a form.

Thanks for the points.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

688 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