Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Pls help me make the macro below works in all worksheets in one good
i.e loop in all sheets of workbook. thxs Sub Statement() Range("A1").CurrentRegion.Sort Key1:=Range("F2"), Order1:=xlAscending, Key2:=Range("D2") _ , Order2:=xlAscending, header:=xlGuess, OrderCustom:=1, MatchCase:= _ False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _ :=xlSortNormal Range("A1").CurrentRegion.Subtotal GroupBy:=6, Function:=xlSum, TotalList:=Array(7), _ Replace:=True, PageBreaks:=False, SummaryBelowData:=True Range("A1").CurrentRegion.Replace What:="SUBTOTAL(9,", Replacement:="sum(", LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Range("A1").CurrentRegion.AutoFormat Format:=xlRangeAutoFormatSimple, Number:=True, Font _ :=False, Alignment:=False, Border:=True, Pattern:=True, Width:=False Columns("G:G").Select Selection.Replace What:="SUBTOTAL(9,", Replacement:="SUM(", LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False End Subl |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way:
For i = 1 To Worksheets.Count Sheets(i).Activate '<YourCode Next i HTH, Paul wrote in message oups.com... Pls help me make the macro below works in all worksheets in one good i.e loop in all sheets of workbook. thxs Sub Statement() Range("A1").CurrentRegion.Sort Key1:=Range("F2"), Order1:=xlAscending, Key2:=Range("D2") _ , Order2:=xlAscending, header:=xlGuess, OrderCustom:=1, MatchCase:= _ False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _ :=xlSortNormal Range("A1").CurrentRegion.Subtotal GroupBy:=6, Function:=xlSum, TotalList:=Array(7), _ Replace:=True, PageBreaks:=False, SummaryBelowData:=True Range("A1").CurrentRegion.Replace What:="SUBTOTAL(9,", Replacement:="sum(", LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Range("A1").CurrentRegion.AutoFormat Format:=xlRangeAutoFormatSimple, Number:=True, Font _ :=False, Alignment:=False, Border:=True, Pattern:=True, Width:=False Columns("G:G").Select Selection.Replace What:="SUBTOTAL(9,", Replacement:="SUM(", LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False End Subl |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Loop through workbooks and worksheets in each workbook | Excel Programming | |||
Naming Worksheets - Loop within a loop issue | Excel Programming | |||
Naming Worksheets - Loop within a loop issue | Excel Programming | |||
(Complex) Loop within loop to create worksheets | Excel Programming | |||
loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook | Excel Programming |