PDA

View Full Version : Using ShowDetail Causes Un-Grouping



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!!

JackkG
12-19-2014, 07:07 AM
Or just to make it easy...how to check for which rows are ungrouped so that I can process with the selection steps? Anyone who has better thoughts on this?

SamT
12-19-2014, 09:39 AM
First see the GroupLevel Property in Help.

Since you are not showing any Loop code, am changing the Thread Title to "Using ShowDetail Causes Un-Grouping"

BTW, Excel4 Macros are very old tech and someday will no longer work.