Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi all, My codes belows take more than 2 minutes to run the file. I believe with better codes it will run faster. Appreciate any advise or suggestion. Sub DebtorMaster() On Error Resume Next Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = False Range("A7").Select Selection.RemoveSubtotal Range("A4").Select Range("SalesData.xls!Sales").AdvancedFilter Action:=xlFilterCopy, _ CriteriaRange:=Range("A3:I4"), CopyToRange:=Range("A6:K6"), Unique:=False Range("A4:I4").Copy Range("A7").Select Workbooks.Open Filename:="C:\My Documents\Master.xls" Sheets("Sheet2").Range("A2").Select ActiveSheet.Paste Range("A2").Select Application.Run "Master.xls!Masterlist" Range("'Master.xls'!Masteroutput").Select Selection.Copy Application.DisplayAlerts = False ActiveWorkbook.Close Application.DisplayAlerts = True Windows("SalesData.xls").Activate Range("A7").Select Selection.End(xlDown).Offset(1, 0).Select ActiveSheet.Paste Range("A7").Select Selection.Sort Key1:=Range("E7"), Order1:=xlAscending, Key2:=Range("F7") _ , Order2:=xlAscending, Key3:=Range("C7"), Order3:=xlAscending, Header:= _ xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Selection.Subtotal GroupBy:=5, Function:=xlSum, TotalList:=Array(7, 8, 9), _ Replace:=True, PageBreaks:=True, SummaryBelowData:=True Selection.AutoFormat Format:=xlRangeAutoFormatSimple Dim lastrow As String lastrow = ActiveSheet.Range("E65536").End(xlUp).Row ActiveSheet.PageSetup.PrintArea = "$A$7:$K$" & lastrow CreateObject("WScript.Shell").Popup "Please preview the page setting is correct," + Chr(10) & "then click PRINT to print the Debtors List", 10, "Printing" End Sub -- taych ------------------------------------------------------------------------ taych's Profile: http://www.excelforum.com/member.php...fo&userid=7096 View this thread: http://www.excelforum.com/showthread...hreadid=494342 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
can this be done faster? | Excel Discussion (Misc queries) | |||
needs to run faster | Excel Programming | |||
Faster way to do this? | Excel Programming | |||
Can faster CPU+larger/faster RAM significantly speed up recalulati | Excel Discussion (Misc queries) | |||
Which one is faster? | Excel Programming |