ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Making Changes to Cells from a user defined function (https://www.excelbanter.com/excel-programming/373964-making-changes-cells-user-defined-function.html)

Elliot[_3_]

Making Changes to Cells from a user defined function
 
Hi,

I know that from vba a udf (and any other code called by that udf) may not
alter the worksheet in any way.

However i have an addin from another product, and it has functions that do
more than just return a value to that cell. Does this require a call to a
dll ??

I tried implementing an asynchronous call (to ADO) and wired up an event but
that just made excel crash.

Thanks Elliot



NickHK

Making Changes to Cells from a user defined function
 
Elliot,
I imagine the code in the add-In is driven by a button or menu click, or
triggered by an Excel event.
If started any of these ways, your code has freedom to the whole Excel
interface.
Whilst there may be ways of exceeding the bounds of a UDF, I would question
your real need to do so, as you would be going against the design of Excel .

NickHK

"Elliot" wrote in message
...
Hi,

I know that from vba a udf (and any other code called by that udf) may not
alter the worksheet in any way.

However i have an addin from another product, and it has functions that do
more than just return a value to that cell. Does this require a call to a
dll ??

I tried implementing an asynchronous call (to ADO) and wired up an event

but
that just made excel crash.

Thanks Elliot





Tom Ogilvy

Making Changes to Cells from a user defined function
 
You can program an event to maintain information on a cell(s) containing the
formula, then react when the results displayed are changed. I don't have a
list, but there are some things a function (UDF) can do. I believe it could
create a defined name for example. It could execute a query (DAO I
believe). It could create a comment. (I didn't specifically test these
before posting, but I believe these are true based on past posts in these
groups). So something like this could be used to communicate with an event.

--
Regards,
Tom Ogilvy

"Elliot" wrote in message
...
Hi,

I know that from vba a udf (and any other code called by that udf) may not
alter the worksheet in any way.

However i have an addin from another product, and it has functions that do
more than just return a value to that cell. Does this require a call to a
dll ??

I tried implementing an asynchronous call (to ADO) and wired up an event
but that just made excel crash.

Thanks Elliot




Elliot[_3_]

Making Changes to Cells from a user defined function
 
Nope it is a genuine user defined function. It returns a value to the
function cell and also populates cells below it. And if the function referes
to ranges that change the function re-runs. The addin must must process the
function and call some code that updates the cells.

I'd like to replicate that . I'll have to experiment with a automation addin

Thanks for the replies


"NickHK" wrote in message
...
Elliot,
I imagine the code in the add-In is driven by a button or menu click, or
triggered by an Excel event.
If started any of these ways, your code has freedom to the whole Excel
interface.
Whilst there may be ways of exceeding the bounds of a UDF, I would
question
your real need to do so, as you would be going against the design of Excel
.

NickHK

"Elliot" wrote in message
...
Hi,

I know that from vba a udf (and any other code called by that udf) may
not
alter the worksheet in any way.

However i have an addin from another product, and it has functions that
do
more than just return a value to that cell. Does this require a call to a
dll ??

I tried implementing an asynchronous call (to ADO) and wired up an event

but
that just made excel crash.

Thanks Elliot








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

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