Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Forcing calculation through automation


I have the following code:

xlSheet.Range['AJ1', EmptyParam].Value:='Days Lost';

xlSheet.Range['AJ2',EmptyParam].Formula:='=NETWORKDAYS(AH2,AI2,BankHols!$A$2:$A$5 00)';

xlSheet.Range['AJ2',EmptyParam].AutoFill(xlSheet.Range['AJ2:AJ'+IntToStr(kount),EmptyParam],xlFillCopy);

The third line above is very quick to execute but Excel then takes a
long time to do the calculation. How can I make sure that the entire
worksheet has been calculated before I move onto the next step?

Nirmal
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Forcing calculation through automation

Couldn't you use Application.Calculate to do this?


"Nirmal Singh" wrote:


I have the following code:

xlSheet.Range['AJ1', EmptyParam].Value:='Days Lost';

xlSheet.Range['AJ2',EmptyParam].Formula:='=NETWORKDAYS(AH2,AI2,BankHols!$A$2:$A$5 00)';

xlSheet.Range['AJ2',EmptyParam].AutoFill(xlSheet.Range['AJ2:AJ'+IntToStr(kount),EmptyParam],xlFillCopy);

The third line above is very quick to execute but Excel then takes a
long time to do the calculation. How can I make sure that the entire
worksheet has been calculated before I move onto the next step?

Nirmal

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Forcing calculation through automation

On Fri, 12 May 2006 12:36:01 -0700, dmthornton wrote:

Couldn't you use Application.Calculate to do this?


That doesn't seem to work either. I've tried to use this code:

xlSheet.Range['AJ1', EmptyParam].Value:='Days Lost';
xlSheet.Range['AJ2',EmptyParam].Formula:='=NETWORKDAYS(AH2,AI2,BankHols!$A$2:$A$5 00)';
xlSheet.Range['AJ2',EmptyParam].AutoFill(xlSheet.Range['AJ2:AJ'+IntToStr(kount),EmptyParam],xlFillCopy);
xlApp.Calculate;

xlSheet.Range['AJ2:AJ'+IntToStr(kount),EmptyParam].SpecialCells(xlFormulas,xlErrors).Value:=0;
xlSheet.Columns.Item['AJ:AJ', EmptyParam].Copy;
xlSheet.Columns.Item['AJ:AJ', EmptyParam].PasteSpecial(xlValues,xlPasteSpecialOperationNone , False, False);

This should calculate the NetWorkDays in column AJ, do a full calcualation and then copy and paste the values
into column AJ. However, when it has finished column AJ contains all zeros.


Nirmal

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
automation of YTD calculation MPP Excel Worksheet Functions 2 November 20th 08 02:15 PM
forcing UDF to run Stefi Excel Worksheet Functions 4 December 29th 05 03:46 PM
Forcing Automatic Calculation Mike Excel Programming 3 May 18th 04 11:37 PM
forcing complete calculation Claude Excel Programming 6 October 21st 03 07:17 PM
Forcing a FileSaveAs John Petty Excel Programming 6 September 14th 03 01:44 AM


All times are GMT +1. The time now is 12:55 PM.

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

About Us

"It's about Microsoft Excel"