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



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?