Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Subtotal in samll file take a lot of time (VBA)

Hi,
I have big xls file. I run macro on this file and in the macro I add new
workbook by:
Set NewBook = Workbooks.Add
In the new workbook I add data (between 5 to 100 rows) and the create
subtotal in the new workbook:
newWB.Activate
newWB.Sheets(1).Activate
ActiveCell.CurrentRegion.Select
Selection.Subtotal GroupBy:=4, Function:=xlSum, TotalList:=Array(7), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True

It take a lot of time to the macro for run Subtotal (look like it calculate
the big file that take many times).
How can I do the subtotal would not calculate the big file
(Application.Calculation = xlManual)
(When I make manually the subtotal on the new workbook it take a second)

Thanks,
Shlomit
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Subtotal in samll file take a lot of time (VBA)

Just a guess...

After you add your 5 to 100 rows, stop your macro.

Check to see where the last used cell is (hit ctrl-end).

Maybe you're subtotalling more data than you think -- up to a million rows in
xl2007!

(I don't see anything that looks like it would take a long time in your code.)



Shlomit wrote:

Hi,
I have big xls file. I run macro on this file and in the macro I add new
workbook by:
Set NewBook = Workbooks.Add
In the new workbook I add data (between 5 to 100 rows) and the create
subtotal in the new workbook:
newWB.Activate
newWB.Sheets(1).Activate
ActiveCell.CurrentRegion.Select
Selection.Subtotal GroupBy:=4, Function:=xlSum, TotalList:=Array(7), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True

It take a lot of time to the macro for run Subtotal (look like it calculate
the big file that take many times).
How can I do the subtotal would not calculate the big file
(Application.Calculation = xlManual)
(When I make manually the subtotal on the new workbook it take a second)

Thanks,
Shlomit


--

Dave Peterson
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
Subtotal To Include Item Description On Subtotal Line Tickfarmer Excel Discussion (Misc queries) 2 February 23rd 10 07:56 PM
A list of data with time stamps, how subtotal at 10 min intervals John Excel Worksheet Functions 4 September 22nd 07 01:21 AM
pasting to subtotal lines without replacing hidden -non-subtotal l harleydiva67 Excel Discussion (Misc queries) 1 October 12th 06 06:02 PM
Subtotal of Subtotal displays Grand Total in wrong row Thomas Born Excel Worksheet Functions 5 January 6th 05 01:46 PM
Run-time changes to subtotal parameter list Dave Peterson[_3_] Excel Programming 1 July 19th 03 02:19 PM


All times are GMT +1. The time now is 10:41 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"