msgbox prompt when user selects data from combo box

T

tjb

When a user selects data from a combo box, how can I have
a message box prompt or User Form pop up?

Once again I know this is an easy one but I'm still
learning VBA!
 
T

Tom Ogilvy

Use the click event of the combobox if it is from the Control Toolbox
toolbar.

Regards,
Tom Ogilvy
 
T

Tom Ogilvy

Continuing to assume the combobox if from the Control Toolbox Toolbar
It still has a click event found in the sheet module


In design mode, double click on the combobox and you should go to a code
module with something like

Private Sub Combobox1_Click()

End Sub

Put your code there.

---------------------
If the combobox is actually a dropdown box from the forms toolbar, you would
right click on it and select Assign Macro. then Assign the macro you want
to run to the dropdown box.

Regards,
Tom Ogilvy
 
D

Dan E

Private Sub ComboBox1_Change()
MsgBox Prompt:="You have selected " & _
ComboBox1.Value, Buttons:=vbOKOnly
End Sub

I chose the change event over the click event, don't know if theirs a whole
lot of difference??

Dan E
 
T

Tom Ogilvy

If you allow a user to type an entry into the combobox, it fires on every
keystroke - that would be a difference.

Regards,
Tom Ogilvy
 
D

Dan E

Yep, never noticed that till now, that does suck. Thanks for pointing that
out...

Dan E
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top