Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Calculation issue

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Calculation issue

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

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"Brad" wrote:

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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Calculation issue

Just to be sure that the application responds to the CalculateFull, try
inserting a
DoEvents
immediately following the Application.CalculateFull
--
Gary''s Student - gsnu200811


"Brad" wrote:

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?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Calculation issue

I found out that I needed to change

..BackgroundQuery = True
..BackgroundQuery = False

To make it work....

One day, thanks for your help.
--
Wag more, bark less


"Gary''s Student" wrote:

Just to be sure that the application responds to the CalculateFull, try
inserting a
DoEvents
immediately following the Application.CalculateFull
--
Gary''s Student - gsnu200811


"Brad" wrote:

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?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Calculation issue

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.
--
Wag more, bark less


--
Wag more, bark less


"Alan Moseley" wrote:

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

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"Brad" wrote:

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?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange Calculation issue LACA Excel Discussion (Misc queries) 1 June 18th 06 09:18 AM
calculation issue? JKC Excel Discussion (Misc queries) 6 March 21st 06 01:29 PM
Calculation speed issue Steve M Excel Discussion (Misc queries) 4 January 14th 06 02:18 AM
Vlookup Calculation Issue cvolkert Excel Worksheet Functions 0 September 7th 05 02:28 AM
Excel Calculation Issue Sean Howard[_2_] Excel Programming 3 December 10th 04 04:45 AM


All times are GMT +1. The time now is 06:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"