Running a macro automatically from a formula

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

can you somehow run a macro automatically from a formula with a specific criteria? Basically having a macro run by itself if a formula's criteria is met. I have a macro assigned to an active X control to copy formulas when I click it. My problem is when I delete a row of data and click on the active X control, there is an extra row of formula's copied because I have removed one. My idea was to have a formula determine whether or not there was to many formulas and then have a macro run automatically to delete that extra row if that was the case. Any ideas?
 
Hi

Macros can be started from other running macros, from events
http://www.cpearson.com/excel/events.htm
or from user interactions ("Run", buttonclicks, ...) -but NOT from worksheet functions. So
either use the "click" event mentioned or some of the worksheet/workbook events.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

Ben said:
can you somehow run a macro automatically from a formula with a specific criteria?
Basically having a macro run by itself if a formula's criteria is met. I have a macro
assigned to an active X control to copy formulas when I click it. My problem is when I
delete a row of data and click on the active X control, there is an extra row of formula's
copied because I have removed one. My idea was to have a formula determine whether or not
there was to many formulas and then have a macro run automatically to delete that extra
row if that was the case. Any ideas?
 
Hi

Macros can be started from other running macros, from events
http://www.cpearson.com/excel/events.htm
or from user interactions ("Run", buttonclicks, ...) -but NOT from worksheet functions. So
either use the "click" event mentioned or some of the worksheet/workbook events.


I've had some luck getting around this limitation by using the if
function in a workbook to evaluate the conditions in the sheet...
the if statement returns "true" when the right conditions are
met, and the sheet change event evaluates the result of the
formula and triggers a macro ..

probably not appropriate for this case but helpful on occasion.
 
Back
Top