Simply Moving a Cell Causes UDF Recalculation

16 views
Skip to first unread message

Tom Baxter

unread,
Apr 25, 2023, 9:21:45 AM4/25/23
to Excel-DNA
I have a UDF (using Excel-DNA) siting in cell A1. I then put some text in another cell, say B5. Putting this text in B5 does not cause the UDF to re-calculate.

The UDF in A1 does not reference B5. When I move B5's content to another cell, say C6, it causes the UDF to re-calculate.

Why would that be? The UDF in A1 is in no way dependent on any other cell. The simple act of moving B5's content to C6 causes the UDF to re-calculate.

Govert van Drimmelen

unread,
Apr 25, 2023, 11:12:10 AM4/25/23
to exce...@googlegroups.com

Hi Tom,

 

That’s not the behaviour I see for a simple function.

What’s the Excel version you’re running on?

 

Is your function perhaps marked as IsVolatile=true, or marked as IsMacroType=true and also has a parameter marked as AllowReference=true (is which case Excel considers it volatile)?

However, in those cases I would expect your function to calculate after entering the value into B5 initially.

 

Inside your function, are you perhaps reading from the sheet somehow, either with the C API or the COM object model?

Those can make Excel concerned about the dependency tree.

 

If not of that explains, maybe you can try a new, simple add-in and function (just returning something like DateTime.Now.ToString("HH:mm:ss.fff") in a brand new workbook?

If you see the same behaviour in that case, while I don’t, I’m suppose something weird is really going on.

 

-Govert

--
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/2c3d1ac2-3589-4ed2-902a-5055635bb991n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages