The idea is to take the code that usually runs inside the button_click() sub,
and place it inside a public sub.
Once you've done that, you can change the button_click() sub to call the
new, public, macro, but also call the same macro form wherever you choose.
Sam
"ryguy7272" wrote:
> Thanks Sam! I want to be able to use this code without clicking a button,
> which is what I did before. Does this allow me to run something like
> button_click() from another macro?
>
> Thanks again!
> Ryan--
>
> --
> Ryan---
> If this information was helpful, please indicate this by clicking ''Yes''.
>
>
> "Sam Wilson" wrote:
>
> > Public Sub YourCode()
> > ...code
> > end sub
> >
> > then:
> >
> > Private Sub cmdSend_Click()
> > Call YourCode
> > End Sub
> >
> > and similarly call it from the other worksheet event?
> >
> > "ryguy7272" wrote:
> >
> > > I am trying to figure out a way to invoke this macro:
> > >
> > > Private Sub cmdSend_Click()
> > > …code
> > > End Sub
> > >
> > > As it is now, action is driven by a click event. I am using propriety
> > > software which may require some kind of click event, but I’m not sure about
> > > that. How can I call this macro from another macro, without requiring a user
> > > to interact by clicking the button.
> > >
> > > This macro will be called by a worksheet event, which is triggered by a
> > > change in a range of cells on another sheet.
> > >
> > > Thanks!
> > > Ryan--
> > >
> > >
> > > --
> > > Ryan---
> > > If this information was helpful, please indicate this by clicking ''Yes''.
|