Interesting question. I did it with a function, there
may be a better way. . .
'cell contents
=IF(B2<0,test(),"")
'module contents
Function Test()
Call MyCode
End Function
Sub MyCode()
MsgBox "HI"
End Sub
I've tried this function but it doesn't actually call the "test()" function in the module, it just prints "test()" in the cell where the function was placed.
Back to original question can a macro be run from a function?
Steve,
I tried this and it worked perfectly for me. I would double-check your vb code and make sure that you have it typed exactly as appears in the post. Good luck.