Calling a macro in an IF Statement

M

Michelle Hillard

Hi Guys,
Is it possible to call a macro in an IF statement?

In column 5 of my worksheet, starting at row 2, if any of these cells have a
value of 'y', then I would like to automatically run the macro called
MoveRowsWithYinColumnD
Is this possible and where would I place this IF statement?
Any help would be greatly appreciated.

--


---------------------------------------------------------------------
"Are you still wasting your time with spam?...
There is a solution!"

Protected by GIANT Company's Spam Inspector
The most powerful anti-spam software available.
http://mail.spaminspector.com
 
P

Paul

Michelle Hillard said:
Hi Guys,
Is it possible to call a macro in an IF statement?

In column 5 of my worksheet, starting at row 2, if any of these cells have a
value of 'y', then I would like to automatically run the macro called
MoveRowsWithYinColumnD
Is this possible and where would I place this IF statement?
Any help would be greatly appreciated.

No, it is not possible. You cannot call a macro from a worksheet formula.

If you think about it, the value of a particular cell may be 'y' now - but
(unless you make changes) will also be 'y' in one second from now, in 5
minutes, this afternoon, tomorrow, next year.... In other words, you cannot
run a macro from the value of a cell being something, as the macro would run
continuously. Possibly what you want to trigger the macro is the cell value
CHANGING TO a particular value. That's an event, which cannot be detected by
a worksheet formula.
 

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

Top