ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Can a macro be made to work based on a formula? (https://www.excelbanter.com/excel-discussion-misc-queries/9935-can-macro-made-work-based-formula.html)

lonnied

Can a macro be made to work based on a formula?
 
Is it possible to have a macro run based on the answer to a question? If the
answer to a certain question is yes then the macro would run.

Myrna Larson

A formula in a worksheet cell can call a function written in VBA. But that
function can only return a result to the cell containing the formula, just
like the built-in functions like SUM and AVERAGE do. The code can't change
other cells, do formatting, etc.


On Tue, 25 Jan 2005 18:59:04 -0800, "lonnied"
wrote:

Is it possible to have a macro run based on the answer to a question? If the
answer to a certain question is yes then the macro would run.



Myrna Larson

Addendum: a Worksheet event macro like Worksheet_Calculate or Worksheet_Change
can monitor the results in a given cell and run more code if the value meets
your criteria.

On Tue, 25 Jan 2005 21:57:45 -0600, Myrna Larson
wrote:

A formula in a worksheet cell can call a function written in VBA. But that
function can only return a result to the cell containing the formula, just
like the built-in functions like SUM and AVERAGE do. The code can't change
other cells, do formatting, etc.


On Tue, 25 Jan 2005 18:59:04 -0800, "lonnied"
wrote:

Is it possible to have a macro run based on the answer to a question? If the
answer to a certain question is yes then the macro would run.




All times are GMT +1. The time now is 04:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com