running macros

  • Thread starter Thread starter piglaup
  • Start date Start date
P

piglaup

Can a macro be run from within a formula?
I would like to run macro A if a cell contains 0 or macro B if that cell
contains anything else.
I know how to setup the NOT formula, but how do you program arguments to get
the macros to run? Is there a way to do that?
 
hi.
short answer....no.
you can write functions in vba that the cell can call but these functions
return value and cannot perform actions.
you might be able to use the worksheet change event to fire a macro but only
if the value in the cell is changed manually. it will not fire with a
formula change.
There is the calculation event but that would probable fire your macro every
time the sheet recalculated. (eeee!)
so if you could provide a bit more info as to what your are trying to do,
someone might be able to suggest a alternative course of actions.

Regards
FSt1
 
You can use the Workbook_SheetCalculate event or Workbook_SheetChange event
to check the value and call the appropriate macro


If this post helps click Yes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top