ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Call Sub from Function? (https://www.excelbanter.com/excel-programming/346380-call-sub-function.html)

G Lykos

Call Sub from Function?
 
Is it possible, and if so, what is the syntax? I set up a simple test case,
and the sub call executes correctly when I step through the function but
does not work when the function is put into a cell formula.

Thanks,
George



Leith Ross[_319_]

Call Sub from Function?
 

Hello George,

If you are creating a User Defined Function (UDF) to work as a
worksheet formula, the first rule is you can not modify another cell on
the worksheet. You may look but not touch. If your Sub is modifiying a
cell, that's the problem. You can change a cell in VBA on the worksheet
with no problem, but you can't change a cell on the worksheet if the
function is a UDF.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=487522



All times are GMT +1. The time now is 01:37 AM.

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