Event triggered macro

Started by dasadler, May 11, 2012, 06:12:59 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dasadler

Say I have a drawing with several shapes representing teams of some sort. One of the number fields in each shape is 'Members'.  I have a macro (TotalMembers) that counts the members and gives a MsgBox with the total members in the team.  It does this by summing all the Members fields in each shape.

I change the number of members in various teams from time to time and would like for the TotalMembers macro to be triggered by a change in the number field of any of the team shapes so I don't have to run the macro manually.

What would be the best approach for this? Any hints on the coding would be much appreciated.


Jumpy

You could create a new user-defined-cell in the shapesheet of each team-shape. Lets call it User.Trigger.
In that cell place a formula like:

=RUNMACRO("TotalMembers")+DEPENDSON(Prop.Members)

DEPENDSON fires whenever the value in Prop.Members is changed and starts the Macro with RUNMACRO.

hth Jumpy