Hi,
In addition to Naju's comments, I would be suspicions about using the
COM Automation interface (via the Range type) to read data from the
sheet from inside a UDF.
I would recommend not doing that, and using the C API (via
ExcelReference) instead.
Reading other parts of the sheet via ExcelRefence.GetValue() from
inside an IsMacroType=true function should be tracked properly by
Excel (meaning your calculation should end in a consistent state).
It's a tricky story exactly how the dependency tracking works in that
case, but it has been examined and written up. Using the COM
Automation interface to do this from a UDF context means you might be
venturing into unsupported, undocumented and poorly understood
territory. You might find Charles Williams's writing on Excel
calculations helpful - see
http://www.decisionmodels.com/calcsecrets.htm
Note that
* functions that are both marked with IsMacroType=true and contain an
AllowReference=true parameter are automatically considered volatile by
Excel.
* marking functions with IsMacroType=true and reading the valus from
the sheet allows you to see the uncalculated values (which is one part
of what you are reporting). You might consider this a feature, and not
a bug.
Regards,
Govert
On May 22, 8:02 pm, Faraz Ahmed Qureshi <
farazem...@gmail.com> wrote:
> Thanx for the timely reply ngm. Sure do appreciate the same. However, the
> UDF seems simple because I redesigned the same to only present my problem.
> The actual UDF is quite a lengthy one. The only way I have yet found to
> resolve the same, eventhough temporarily, is by inserting the RANDBETWEEN
> functions (or the precedent data) only after I have inserted the main UDF
> first.