Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2007

Tip: Looking for answers? Try searching our database.

Subtotal in samll file take a lot of time (VBA)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Shlomit - 25 Jan 2007 09:08 GMT
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 - 25 Jan 2007 15:09 GMT
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.)

> Hi,
>  I have big xls file. I run macro on this file and in the macro I add new
[quoted text clipped - 16 lines]
> Thanks,
> Shlomit

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.