Here you can get around the limitation; you must do it indirectly. Method copied from Excel - How to populate cells from a custom function? :
In the standard module:
Public triggger As Boolean Public carryover As Variant Function reallysimple(r As Range) As Variant triggger = True reallysimple = r.Value carryover = r.Value / 99 End Function
In the text of the worksheet:
Private Sub Worksheet_Calculate() If Not triggger Then Exit Sub triggger = False Range("C1").Value = carryover End Sub
It can be expanded for your purposes. Essentially, UDF updates public variables, which are then read from the Worksheet_Calculate event to do ... whatever you like.
Another tricky approach would be to write a vbscript file from your function, which will try to automate Excel and run it through Shell. However, the method described above is much more reliable.
source share