View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
om om is offline
external usenet poster
 
Posts: 18
Default Excel grouped data

If your data has 4 levels of grouped rows then you can use;

Sub Collapse()
ActiveSheet.Outline.ShowLevels RowLevels:=4
ActiveSheet.Outline.ShowLevels RowLevels:=3
ActiveSheet.Outline.ShowLevels RowLevels:=2
ActiveSheet.Outline.ShowLevels RowLevels:=1
End Sub
Sub Expand()
ActiveSheet.Outline.ShowLevels RowLevels:=1
ActiveSheet.Outline.ShowLevels RowLevels:=2
ActiveSheet.Outline.ShowLevels RowLevels:=3
ActiveSheet.Outline.ShowLevels RowLevels:=4
End Sub

"Grey Old Man" wrote:

I am using an Excel 2002 spreadsheet with 20+ worksheets that all contain
grouped data. Can anyone help with a macro that will automatically expand the
grouped data in each of the worksheets, and go to the last cell.

Similarly a macro is required to collapse the grouped data in each of the
worksheets, and go to the home cell.