running a macro by a click

  • Thread starter Thread starter Nazeer
  • Start date Start date
N

Nazeer

I have a macro that I want to run everytime a user select
an option from a drop down list. What the macro does is,
it takes the user to a specific cell depending upon their
selection.
Currently, the macro can only be run either manually or by
clicking on a toolbar button. But I want the macro to
automatically run as soon as the user makes a selection.

Any ideas?

Thanks.
 
If you are using a combobox from the control toolbox toolbar, then use the
click event.
 
Thanks, Tom. How do I use the click event. Can you provide
specific details. I am not familiar with events.

thanks.
 
How do I use the click event. Can you provide more details
as I am not very familiar with events?

Thanks.
 
after you place the combobox on the worksheet, right click on it and select
view code.

You should be in the click event.

Put the code you want to run there.
 
Nazeer said:
How do I use the click event. Can you provide more details
as I am not very familiar with events?

Thanks.
If you don't understand Tom's answer, you are a beginner. You haven't
read the visual basic help yet either, I would say. Events are certain
things that can happen in Excel. They are defined in advance, one
event is "right click" on a control, like your pop-down menu. When an
event happens, Excel will look for a special subroutine named after
the event, and if it finds code, it will be run. This is how you do
what you want. It is well documented in help. The Visual Basic editor
will show you all the events associated with an object when you are
editing a code module belonging to the object (above the text editing
screen in VB there are two pop-up lists. Change the left one to be the
object you are editing, and the right one will show you the available
event subroutines, at least in my version of Excel.
 
Back
Top