"%^{F9}" doesn't cause calcaulation

G

Guest

Hi all,


I use Application.SendKeys "%^{F9}", True to cause calculation, but it
failed. My Excel version 2000.

Clara
 
G

Guest

Sub kick_it()
Application.SendKeys "{F9}"
DoEvents
End Sub

will cause a single calculation, but will leave the mode in Manual
 
G

Guest

Application.Calculation isn't equivalent to the sendkeys you show.

Try using Application.CalculationFull
 
G

Guest

Hi Tom,

Could you tell me the difference between the two method? They all works well.

Clara
 
G

Guest

Hi Gary's Student,

When I run my macro which contains your method, F5 press became F9 press
that means a break point is set at the line I press F5 instead of running the
macro.
Could you tell me the reason. The same thing happened to me before.

Clara
 
N

NickHK

Keys are sent to the active application, whichever that is.
So you cannot run such code from the VBA IDE and consequently cannot debug
it.
Run from the click a button will work.

NickHK
 
G

Guest

CalculateFull does a more complete recalculation of the workbook. It doesn't
just recalculate the cells which excel considers in need of calculation -
this is what calculate does. Since you didn't write the macro, the original
author appeared to want to do a CalculateFull (which did not exist as a macro
command in xl97 and thus many used the sendkeys combination you show).

From VBA help:
CalculateFull:
Forces a full calculation of the data in all open workbooks.
CalculateFullRebuild: (added in xl2002 I believe)
For all open workbooks, forces a full calculation of the data and rebuilds
the dependencies.

-------------------------------------------
Calculate:
Calculates all open workbooks, a specific worksheet in a workbook, or a
specified range of cells on a worksheet, as shown in the following table.

When using "calculate", To calculate Follow this example
All open workbooks - Application.Calculate (or just Calculate)
A specific worksheet - Worksheets(1).Calculate
A specified range - Worksheets(1).Rows(2).Calculate
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top