Update value. Function

S

shapper

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
 
P

Per Jessen

Hi Miguel

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

Application.Volatile

Regards,
Per
 
S

shapper

Hi Miguel

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

Application.Volatile

Regards,
Per

Thanks,

It worked just fine.

Thank You,
Miguel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top