I am using all the solutions that appear in:
How to refresh ALL cell through VBA
Getting Excel to refresh data on sheet from within VBA
ActiveSheet.EnableCalculation = False
ActiveSheet.EnableCalculation = True
or
Application.Calculate
or
Application.CalculateFull
None of them works in Excel 2010. When I go to the cell and right click refresh it works. How can I refresh within VBA?
Sheets("Name_of_sheet").Range("D424").Refresh
raises an
exception 438
Questions:
- How can I make the script support Excel 2003, 2007, 2010?
- How can I choose the source file to refresh from using VBA?
EDIT:
I want to simulate a right mouse click and choose refresh in the menu in
worksheet 3
. That is the entire story.I work on an Excel file created 10 years ago. When opening in Excel 2010, I can go to a cell and right click on it and choose refresh and then choose the .txt file to refresh from. I am trying to do it automatically within VBA.
I finally used mouse events and keystrokes to do it:
For an individual cell you can use:
Range("D13").Calculate
OR
just a reminder;
be careful when using
this sets the entire excel application to calculate formula's either automatically or manually. If you use
you'll notice your automatic formulas no longer work.
cheers
You could try using
Application.Calculation