View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Niek Otten Niek Otten is offline
external usenet poster
 
Posts: 3,440
Default VBA created formulas won't autocalculate

Hi Frans,

I found it a bit difficult to see what exactly you were trying to do.
Nevertheless, a few general remarks about functions and macros.
You can not change anything in worksheets from within a function, just from
a macro.
All data the function needs to do what it has to do, should be declared as
arguments and given as arguments to the actual function call. Any direct
reference to cells in worksheets will not be recognized bij Excel; therefore
they will not recalculate reliably. "Application.Volatile" is often
recommende to cure this, but there are still doubts as to Excel will know
the order of recalculation. How could it know?
So in general, always pass your data as arguments.

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"Frans Muller" wrote in message
om...
Thanks for the quick reply.

I did try the application.volatile statement, unfortunately it did not
help.
But I have to say that I'm not sure where to place the statement. I
placed it in the beginning of the Function Naar_vergelijk.

For now, I redesigned the workbook so that it doesn't need to enter
formulas in the worksheet, and that the transportation of the data is
manually by a macro.

Still, it is a problem I've encountered several times now. And the
advantages of entering formulas in a worksheet by macro are too great
to let go, and I hope to find a "cure" someday before I'm old and
grey.

Frans