Apr 29 2009
Excel – Update formulas on Open
Most of the time this is a relatively trivial exercise. In the majority of cases, simply setting ‘Workbook Calculation’ to ‘Automatic’ in the Excel options will give the desired effect.
However, I recently stumbled across a situation where this doesn’t work. If you find yourself entering data into an Excel workbook through some other means – in my case, using the OpenXML libraries in C# – then you may need to force excel to update any formulas you had.
The solution is simple, using a small VB macro. To get it to happen when the workbook is opened, use the following code:
Private Sub Workbook_Open() Application.CalculateFullRebuild End Sub
If you put that in the code for the main workbook (as opposed to one of the sheets) then it should happen when the spraedsheet is opened.
No responses yet