1

Possible Duplicate:
Refresh Excel VBA Function Results

I have simple function in excel:

Function Test() As String

    Test = Now

End Function

and I am able to use it as:

enter image description here

Now why is it that when I press the button:

enter image description here

the value does not update !?

For example if I have a cell with the formula =Rand() every time I click the calculate value I will get a different number. How can I make my custom function behave the same way ?

Community
  • 1
  • 1
Tono Nam
  • 34,064
  • 78
  • 298
  • 470

1 Answers1

4

Add application.volatile to the job

Btw, now() is available as an excel function

chris neilsen
  • 52,446
  • 10
  • 84
  • 123
  • What is the duff? thanks for the help. I just use the now example to illustrate my problem. My real function reads a value from a web service on the internet... – Tono Nam Dec 19 '12 at 21:41
  • I just placed Application.volatile on the first line of the function and it worked. Thanks! – Tono Nam Dec 19 '12 at 21:44