Excel: Using VBA to force recalculation
Hi all,
Does anyone know how to make Excel recalculate the worksheets via VBA? It can be done in the actual workbook by pressing the F9 key but there doesn't seem to be a corresponding "recalculate" function in the VBA section.
It would need to be able to run as part of a macro located in a standard code module.
Thanks
-Rob
Re: Excel: Using VBA to force recalculation
When I recorded a macro pressing F9 the word "Calculate" appeared.
That help?
Re: Excel: Using VBA to force recalculation
Code:
Application.Calculate
That seems to work. Does anyone know if it re-calculates all worksheet formulas? I actually need the code because I am using the RAND() function and need to run an analysis using a variety of randomly generated values, but I don't want the whole worksheet to recalculate i.e. no need for the rest of the formulas in the workbook to recalculate, just the RAND() functions.
Thanks
-Rob
Re: Excel: Using VBA to force recalculation
I think you can use calculate on specific ranges, so if you know where your RAND() functions are you should be set.