Archive of Mr Excel Message Board


Back to Controls in Excel archive index
Back to archive home

combo boxes

Posted by alex on August 24, 2001 7:14 AM
hi there,
I am trying to insert a combo box into a 97 worksheet, that when when a choice is selected, it runs a couple of lines of vb script. can't work it out. if anyone can point me to examples of code, would be most grateful. thanks

Re: combo boxes

Posted by Robb on August 25, 2001 6:21 AM
Alex

Depends whether it is from the Control Menu (ActiveX) or Forms Menu.

If it is ActiveX (Controls Menu), write the code in an event for the control - probably the "Change" event.
To do this:

-Open Visual Basic Editor (VBE) (Atl + F11)
-in Project Explorer double click on the Sheet name
-Code window for the Sheet will open
-Click on the left drop down at the top of the code window
-Select the name of the ComboBox
-In the right drop down, select "Change"
-Write your code in the event procedure

If it is from the Forms Menu, write your code as a macro, then:

-Right click on the ComboBox
-Select "Assign Macro" from the Menu
-Select your macro name to attach it to the ComboBox

Any help?


This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.