Recalculate sheet excel in VBA when getting numbers from cells with Cells.Value -



Recalculate sheet excel in VBA when getting numbers from cells with Cells.Value -

here simple illustration explain want do:

function fun(x double) worksheets("sheet1").activate y = cells(2, "c").value fun = x + y end function

so, if changing value of x within excel sheet, result of fun alter expected, if alter value of y, nil happens. must alter x 1 time again function new value of y , calculate proper value.

is there way add together code in vba function result of fun automatically update alter of value y?

add application.volatile function first line.

function fun(x double) application.volatile 'worksheets("sheet1").activate dim y long y = worksheets("sheet1").cells(2, "c").value fun = x + y end function

the assignment y should done directly, not activating worksheet.

excel vba excel-vba auto-update

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -