Calculation issue

B

Brad

Using Excel 2007

I have two macros: one that gets data from an external source and the other
that takes information from excel and creates PDF's. If I run each macro
individually, I get the right results. If I call the macro that creates the
PDF's from the macro that gets the data (the pdf's have not been updated with
the new information). The workbook is on automatic calculation mode.

I've have tried adding the lines
Application.Calculatefull
Application.Wait Now + timevalue("00:00:03")

in the first macro before calling the second macro - (with no success) any
suggestions?
 
A

Alan Moseley

Try switching off Auto Calculation and calculating them in the order that you
want them done, for example:-

Public Sub MyCalculate()
Dim sh As Worksheet
Application.Calculation = xlCalculationManual
For Each sh In Workbooks("SourceData").Worksheets
sh.Calculate
Next sh
For Each sh In Workbooks("PDFData").Worksheets
sh.Calculate
Next sh
Application.Calculation = xlCalculationAutomatic
End Sub
 
G

Gary''s Student

Just to be sure that the application responds to the CalculateFull, try
inserting a
DoEvents
immediately following the Application.CalculateFull
 
B

Brad

I found out that I needed to change

..BackgroundQuery = True
..BackgroundQuery = False

To make it work....

One day, thanks for your help.
 
B

Brad

Tried your method and it didn't work, found out that changing the following
..BackgroundQuery = True
to
..BackgroundQuery = False

Worked....

One day I'll get it, thanks for your help.
 

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