UDF on-load mass update error

Skip to first unread message

benjamin goad

Sep 8, 2023, 6:49:36 PMSep 8
to Excel-DNA
I have multiple UDF functions entered in a worksheet.
When I open the workbook there is no issue, but upon loading my AddIn, every cell with a UDF formula is populated with the data (dynamic array) from just 1 of the functions. The cell that each of the UDFs are entered in maintain their individual formulas, but are overlayed with the dynamic array of another.

The function that overlays all others is not random, it is from the first open worksheet (tab), however if multiple UDFs exist in the first tab I could not determine the mechanism that chooses which one populates the remaining UDFs.

My end goal is to have each UDF update (independently) on loading the AddIn
I will 100% settle for having none of the UDFs update unless Re-Entered. 

Things I have Tried:
 - app.CalculateFull()
 - worksheet.EnableCalculation = false for all worksheets, then updating each individually
 -  isVolatile = false / not specifying

Setting excelApp.Calculation = Excel.XlCalculation.xlCalculationManual;  works, however any other RTD function, like =NOW() is disabled.

Could it have something to do with a mutual reference to some object? Could I forcibly unpair my UDFs from the formula dependency tree? 

Any help would be greatly appreciated, I've been scratching my head for some time.


Govert van Drimmelen

Sep 9, 2023, 7:12:00 PMSep 9
to exce...@googlegroups.com

Hi Benjamin,


It would help if you could make a small self-contained example that shows the behaviour you are seeing.

I can’t quite follow what you mean by the “overlays” or how the UDFs are “populated”.

It sounds like the problem is related to your function implementations, and not a general Excel or Excel-DNA problem.

One source of trouble might be async functions where you are not passing the right parameter information to the async calls



You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/2b2bf760-c250-4418-bd3c-39e9ef1a854dn%40googlegroups.com.

benjamin goad

Sep 13, 2023, 12:53:52 PMSep 13
to Excel-DNA
Sorry for the confusion, but thanks for the quick reply.
I did manage find the issue in the parameters for the async calls.
Hopefully I can explain well enough to be of help to someone else.

In my code, I use this method to retrieve our API data (JSON array) by passing our async request methods as Func<Task<TResult>> taskSource:

ExcelAsyncUtil.Observe(callerFunctionName, callerParameters, delegate
                var task = taskSource();
                return new ExcelTaskObservable<TResult>(task);

My issue was coming from using the same callerFunctionName (i.e. "Fetch Content") within different Functions.
This made it such that the same data was being returned to all Functions using the same callerFunctionName.
The data from 1 function was displayed by any function with the callerFunctionName even if the taskSource() was different.

Im sure this has been documented, but I couldnt find the link to share here.
Simple fix though, and again, thanks so much for your reply.
Reply all
Reply to author
0 new messages