JackkG
12-18-2014, 03:10 PM
Hi,
I'm trying to loop through the group/ungroup macro here.
Here is the piece of code:
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=2
ActiveSheet.Outline.ShowLevels RowLevels:=1
ExecuteExcel4Macro "SHOW.DETAIL(1,1,TRUE)" 'this ungroups rows 1 to 5
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=2
ActiveSheet.Outline.ShowLevels RowLevels:=1
ExecuteExcel4Macro "SHOW.DETAIL(1,7,TRUE)" 'this ungroups rows 6 to 10
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=2
ActiveSheet.Outline.ShowLevels RowLevels:=1
ExecuteExcel4Macro "SHOW.DETAIL(1,13,TRUE)" 'this ungroups rows 11 to 15
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=2
ActiveSheet.Outline.ShowLevels RowLevels:=1
ExecuteExcel4Macro "SHOW.DETAIL(1,19,TRUE)" 'this ungroups rows 15 to 20
------
I want to loop through this ungrouping, if rows 1 to 5 is ungrouped then rows 1 to 5 and row 22 to 40 are selected. If rows 6 to 10 is ungrouped then rows 6 to 10 and 22 to 40 is selected...and so on.
Can someone help me with how the looping for this will go.
Thanks!!
I'm trying to loop through the group/ungroup macro here.
Here is the piece of code:
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=2
ActiveSheet.Outline.ShowLevels RowLevels:=1
ExecuteExcel4Macro "SHOW.DETAIL(1,1,TRUE)" 'this ungroups rows 1 to 5
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=2
ActiveSheet.Outline.ShowLevels RowLevels:=1
ExecuteExcel4Macro "SHOW.DETAIL(1,7,TRUE)" 'this ungroups rows 6 to 10
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=2
ActiveSheet.Outline.ShowLevels RowLevels:=1
ExecuteExcel4Macro "SHOW.DETAIL(1,13,TRUE)" 'this ungroups rows 11 to 15
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=2
ActiveSheet.Outline.ShowLevels RowLevels:=1
ExecuteExcel4Macro "SHOW.DETAIL(1,19,TRUE)" 'this ungroups rows 15 to 20
------
I want to loop through this ungrouping, if rows 1 to 5 is ungrouped then rows 1 to 5 and row 22 to 40 are selected. If rows 6 to 10 is ungrouped then rows 6 to 10 and 22 to 40 is selected...and so on.
Can someone help me with how the looping for this will go.
Thanks!!