How to refresh cells in Excel 2010 using VBA?

1,838 views
Skip to first unread message

Zozo 4534

unread,
Nov 22, 2012, 7:21:12 PM11/22/12
to exce...@googlegroups.com

I am using all the solutions that appear above:

    ActiveSheet.EnableCalculation = False  
    ActiveSheet.EnableCalculation = True

or 

    Application.Calculate

or 

    Application.CalculateFull


but none of them works in excel 2010, when I go to the cell and right click `refresh` it works. How can I refresh it within VBA.


This option : `Sheets("Name_of_sheet").Range("D424").Refresh` raise an `exception 438`.

questions:

1. How can I make the script supports `excel 2003,2007,2010`?
2. How can I choose using VBA the source file to refresh from?


edit: 
-----

I want to simulate a right mouse clicking and choosing refresh in the menu in worksheet 3. that's the all story. 

Bhupesh Singal

unread,
Dec 24, 2012, 1:46:30 AM12/24/12
to exce...@googlegroups.com
Methods to refresh cells using vba
 
1)  Application.Calculation = xlCalculationManual
Application
.Calculation = xlCalculationAutomatic
 
2)Range("D13").Calculate

OR  Cells(13, "D").Calculate

3)Sheets("worksheet34").Select
Range
("D15").Select
Application
.WindowState = xlMaximized
SetCursorPos
200, 600 'set mouse position at 200, 600
Call mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0) 'click left mouse
Application
.SendKeys ("R")
 
4)Sheets("Name_of_sheet").Range("D424").Refresh
 
5) ActiveSheet.EnableCalculation = False 
ActiveSheet
.EnableCalculation = True

or

Application.Calculate

or

Application.CalculateFull
 
 
Rgds
Bhupesh Singal
 
Reply all
Reply to author
Forward
0 new messages