ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Update value. Function (https://www.excelbanter.com/excel-programming/436429-update-value-function.html)

shapper

Update value. Function
 
Hello,

I created a simple function on VBA as follows:

Function Test() As Integer
Dim I As Single
For I = 17 To 24
Test = (Test + 1) * Range("Examples_1_a_4!B" & I)
Next I
End Function

On my Excel sheet I have on a cell the following:
=Test()

It works but when I change a value in the range I need to go to the
result cell and click enter to the value be updated.

Why?

Thanks,
Miguel

Per Jessen

Update value. Function
 
Hi Miguel

You have to make you funciton volatile, to do so, add this as first line in
you sub:

Application.Volatile

Regards,
Per

"shapper" skrev i meddelelsen
...
Hello,

I created a simple function on VBA as follows:

Function Test() As Integer
Dim I As Single
For I = 17 To 24
Test = (Test + 1) * Range("Examples_1_a_4!B" & I)
Next I
End Function

On my Excel sheet I have on a cell the following:
=Test()

It works but when I change a value in the range I need to go to the
result cell and click enter to the value be updated.

Why?

Thanks,
Miguel



shapper

Update value. Function
 
On Nov 20, 1:34*pm, "Per Jessen" wrote:
Hi Miguel

You have to make you funciton volatile, to do so, add this as first line in
you sub:

Application.Volatile

Regards,
Per

"shapper" skrev i ...

Hello,


I created a simple function on VBA as follows:


Function Test() As Integer
*Dim I As Single
*For I = 17 To 24
* *Test = (Test + 1) * Range("Examples_1_a_4!B" & I)
*Next I
End Function


On my Excel sheet I have on a cell the following:
=Test()


It works but when I change a value in the range I need to go to the
result cell and click enter to the value be updated.


Why?


Thanks,
Miguel




Thanks,

It worked just fine.

Thank You,
Miguel


All times are GMT +1. The time now is 11:15 AM.

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