ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA UDF Calculation (not) (https://www.excelbanter.com/excel-programming/379450-vba-udf-calculation-not.html)

Greg Longtin

VBA UDF Calculation (not)
 
To all,

I've got a UDF, but Excel will only calc it when the cell containing it is
edited, ie, F2, enter.

How can I force a calc? I tried 'Calculate' on the SheetActivate event, and
nothing happens...

TIA,

Greg



Tim Williams

VBA UDF Calculation (not)
 
What are the inputs to the UDF? Does it use any data not passed as a parameter?

--
Tim Williams
Palo Alto, CA


"Greg Longtin" wrote in message ...
To all,

I've got a UDF, but Excel will only calc it when the cell containing it is
edited, ie, F2, enter.

How can I force a calc? I tried 'Calculate' on the SheetActivate event, and
nothing happens...

TIA,

Greg





Greg Longtin

VBA UDF Calculation (not)
 
Tim,

What are the inputs to the UDF? Does it use any data not passed as a
parameter?


One cell value, which is the name a worksheet in the workbook to use for the
calculation.

Greg



NickHK

VBA UDF Calculation (not)
 
Greg,
Excel normally does not recalculate functions if their inputs have not
changed.
But may be application.Volatile will give the desired behaviour.

NickHK

"Greg Longtin" wrote in message
...
Tim,

What are the inputs to the UDF? Does it use any data not passed as a
parameter?


One cell value, which is the name a worksheet in the workbook to use for

the
calculation.

Greg





Greg Longtin

VBA UDF Calculation (not) solution
 
Tim,

Found a solution. Simply put, the udf find a date in other sheets, and it's
used in a summary sheet. I orginally set it up with one parameter, which
tells it what sheet to use. The workbook is a summary of our truck
maintanance (one sheet per), and the udf is used in the summary page.

Anyway, the summary sheet has a cell that uses TODAY() for revision date. I
added this as a parameter to the UDF, and although I'm not using it for
anything, it forces the recalc.

Thanks,

Greg




All times are GMT +1. The time now is 04:46 PM.

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