Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Updating a Function's Result

Hello Experts,
I have Excel 97 Pro on Win98SE.

I have written a custom function which depends on date, therefore, its
result must be refreshed every time the workbook is opened; like NOW
function does.
How can I give my function the ability to update its results automatically?

Thank you,
--
Syed Zeeshan Haider.
http://szh.20m.com/


-----------------------------------
Allah says to Mankind:
"Then which of the favours of your Lord will ye deny?"


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Updating a Function's Result

somewhere in your spreadsheet, have a cell with the current date, i.e, a
cell "$A$1" with the formula '=Today()' or Now(). Then include a new
parameter into your function, i.e., CurrentDate as Date, and when you use
your function, use the cell with the date as a source for CurrentDate. Your
function use will look like this:

=myfunction(.....whatever other parameters you have already..., $A$1)

Every time you open your workbook, Today (or Now) will recalculate cell
$A$1, and this will force Excel to recalculate your function.

Cheers,

RADO


"Syed Zeeshan Haider" wrote in
message ...
Hello Experts,
I have Excel 97 Pro on Win98SE.

I have written a custom function which depends on date, therefore, its
result must be refreshed every time the workbook is opened; like NOW
function does.
How can I give my function the ability to update its results

automatically?

Thank you,
--
Syed Zeeshan Haider.
http://szh.20m.com/


-----------------------------------
Allah says to Mankind:
"Then which of the favours of your Lord will ye deny?"




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default Updating a Function's Result

Hi syed,

You need to add this line to your function.

Application.Volatile

Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com

"Syed Zeeshan Haider" wrote in
message ...
Hello Experts,
I have Excel 97 Pro on Win98SE.

I have written a custom function which depends on date, therefore, its
result must be refreshed every time the workbook is opened; like NOW
function does.
How can I give my function the ability to update its results

automatically?

Thank you,
--
Syed Zeeshan Haider.
http://szh.20m.com/


-----------------------------------
Allah says to Mankind:
"Then which of the favours of your Lord will ye deny?"




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Updating a Function's Result

volatile will work, but it slows down spreadsheet a lot, if you use the
function many times. Taking an updatable parameter in is a better solution,
in my opinion.

RADO


"Charles Williams" wrote in message
...
Hi syed,

You need to add this line to your function.

Application.Volatile

Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com

"Syed Zeeshan Haider" wrote in
message ...
Hello Experts,
I have Excel 97 Pro on Win98SE.

I have written a custom function which depends on date, therefore, its
result must be refreshed every time the workbook is opened; like NOW
function does.
How can I give my function the ability to update its results

automatically?

Thank you,
--
Syed Zeeshan Haider.
http://szh.20m.com/


-----------------------------------
Allah says to Mankind:
"Then which of the favours of your Lord will ye deny?"






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default Updating a Function's Result

Hi Rado,

NOW and TODAY are volatile functions anyway.

I do not see the advantage in making a function volatile by including an
additional argument that refers to a volatile function rather than just
making the function volatile. It certainly will not run any faster or less
often, and seems more complicated.

Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com

"RADO" wrote in message
...
volatile will work, but it slows down spreadsheet a lot, if you use the
function many times. Taking an updatable parameter in is a better

solution,
in my opinion.

RADO


"Charles Williams" wrote in message
...
Hi syed,

You need to add this line to your function.

Application.Volatile

Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com

"Syed Zeeshan Haider" wrote in
message ...
Hello Experts,
I have Excel 97 Pro on Win98SE.

I have written a custom function which depends on date, therefore, its
result must be refreshed every time the workbook is opened; like NOW
function does.
How can I give my function the ability to update its results

automatically?

Thank you,
--
Syed Zeeshan Haider.
http://szh.20m.com/


-----------------------------------
Allah says to Mankind:
"Then which of the favours of your Lord will ye deny?"










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Updating a Function's Result

Thank you for the information!

Your idea is very wise but I have to make my functions, fully automatic and
independent like NOW() is. Such functions could be distributed to others who
need them without any deep knowledge of VBA or such expertise of Excel like
you have.

Thank again!
--
Syed Zeeshan Haider.
http://szh.20m.com/


-----------------------------------
Allah says to Mankind:
"Then which of the favours of your Lord will ye deny?"


"RADO" wrote in message ...
somewhere in your spreadsheet, have a cell with the current date, i.e, a
cell "$A$1" with the formula '=Today()' or Now(). Then include a new
parameter into your function, i.e., CurrentDate as Date, and when you use
your function, use the cell with the date as a source for CurrentDate.

Your
function use will look like this:

=myfunction(.....whatever other parameters you have already..., $A$1)

Every time you open your workbook, Today (or Now) will recalculate cell
$A$1, and this will force Excel to recalculate your function.

Cheers,

RADO


"Syed Zeeshan Haider" wrote in
message ...
Hello Experts,
I have Excel 97 Pro on Win98SE.

I have written a custom function which depends on date, therefore, its
result must be refreshed every time the workbook is opened; like NOW
function does.
How can I give my function the ability to update its results

automatically?

Thank you,
--
Syed Zeeshan Haider.
http://szh.20m.com/


-----------------------------------
Allah says to Mankind:
"Then which of the favours of your Lord will ye deny?"






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Updating a Function's Result

Hi Charles,

I agree with your opinion regarding NOW function, because it changes with
the timer. But I assume TODAY, even if it's volatile, does not change the
value within a day, and therefore, does not trigger a call of the user
function (my understanding is that the call is made only when the argument
changes value, am I correct?). If true, it can be a big advantage if the
user function is time-consuming or used extensively. It's also easier to
debug code without volatile functions.

Respectfully -
RADO



"Charles Williams" wrote in message
...
Hi Rado,

NOW and TODAY are volatile functions anyway.

I do not see the advantage in making a function volatile by including an
additional argument that refers to a volatile function rather than just
making the function volatile. It certainly will not run any faster or less
often, and seems more complicated.

Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com

"RADO" wrote in message
...
volatile will work, but it slows down spreadsheet a lot, if you use the
function many times. Taking an updatable parameter in is a better

solution,
in my opinion.

RADO


"Charles Williams" wrote in message
...
Hi syed,

You need to add this line to your function.

Application.Volatile

Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com

"Syed Zeeshan Haider" wrote in
message ...
Hello Experts,
I have Excel 97 Pro on Win98SE.

I have written a custom function which depends on date, therefore,

its
result must be refreshed every time the workbook is opened; like NOW
function does.
How can I give my function the ability to update its results
automatically?

Thank you,
--
Syed Zeeshan Haider.
http://szh.20m.com/


-----------------------------------
Allah says to Mankind:
"Then which of the favours of your Lord will ye deny?"










  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default Updating a Function's Result

Hi Rado,

Unfortunately Excel recalculates dependents of calculated cells even if the
calculated value does not change.

So TODAY is volatile, and even if the value returned by TODAY does not
change, any formula referring to the cell containing TODAY will be
recalculated at every recalculation.


Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com

"RADO" wrote in message
...
Hi Charles,

I agree with your opinion regarding NOW function, because it changes with
the timer. But I assume TODAY, even if it's volatile, does not change the
value within a day, and therefore, does not trigger a call of the user
function (my understanding is that the call is made only when the argument
changes value, am I correct?). If true, it can be a big advantage if the
user function is time-consuming or used extensively. It's also easier to
debug code without volatile functions.

Respectfully -
RADO



"Charles Williams" wrote in message
...
Hi Rado,

NOW and TODAY are volatile functions anyway.

I do not see the advantage in making a function volatile by including an
additional argument that refers to a volatile function rather than just
making the function volatile. It certainly will not run any faster or

less
often, and seems more complicated.

Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com

"RADO" wrote in message
...
volatile will work, but it slows down spreadsheet a lot, if you use

the
function many times. Taking an updatable parameter in is a better

solution,
in my opinion.

RADO


"Charles Williams" wrote in message
...
Hi syed,

You need to add this line to your function.

Application.Volatile

Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com

"Syed Zeeshan Haider" wrote

in
message ...
Hello Experts,
I have Excel 97 Pro on Win98SE.

I have written a custom function which depends on date, therefore,

its
result must be refreshed every time the workbook is opened; like

NOW
function does.
How can I give my function the ability to update its results
automatically?

Thank you,
--
Syed Zeeshan Haider.
http://szh.20m.com/


-----------------------------------
Allah says to Mankind:
"Then which of the favours of your Lord will ye deny?"












  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Updating a Function's Result

Hey! You! Charles! Yes I am talking to you. You are an intelligent guy. Your
response worked. I just want to say MANY THANKS. ;-)

Thanks again!
--
Syed Zeeshan Haider.
http://szh.20m.com/


-----------------------------------
Allah says to Mankind:
"Then which of the favours of your Lord will ye deny?"


"Charles Williams" wrote in message
...
Hi syed,

You need to add this line to your function.

Application.Volatile

Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com

"Syed Zeeshan Haider" wrote in
message ...
Hello Experts,
I have Excel 97 Pro on Win98SE.

I have written a custom function which depends on date, therefore, its
result must be refreshed every time the workbook is opened; like NOW
function does.
How can I give my function the ability to update its results

automatically?

Thank you,
--
Syed Zeeshan Haider.
http://szh.20m.com/


-----------------------------------
Allah says to Mankind:
"Then which of the favours of your Lord will ye deny?"






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
vlookup with result TRUE not updating cell MEB310 Excel Worksheet Functions 2 February 1st 10 04:22 PM
use function to change a string to function's parameter ViestaWu Excel Worksheet Functions 3 November 21st 07 12:42 PM
Cells display function's text rather than its results tonerowlabs Excel Discussion (Misc queries) 4 July 8th 06 12:47 PM
A correct IF function doesn't show the function's result in cell Michael Excel Discussion (Misc queries) 1 April 10th 06 09:10 AM
want sumif function's range to evaluate 2 columns Debgala Excel Worksheet Functions 7 November 6th 05 03:46 AM


All times are GMT +1. The time now is 06:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"