View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Stav19 Stav19 is offline
external usenet poster
 
Posts: 44
Default Grouping a range of sheets

Hi All

What I'm trying to do is between a range of sheets ("Reports==" and
"Pivots==") ensure that the relevant columns and rows are grouped
together.

I've recorded the macro and that works fine, but I wanted to try and
do it using a macro that wasn't recorded...

Here's what I've got so far:

Sub ShtsGpd2()
'ShtsGpd2 Macro
'Slightly better method of grouping sheets together based on a range,
starting point etc.

Dim msheetsarray As Sheets
Dim sh As Worksheet

Set msheetsarray = Worksheets(Array("Reports==", "Pivots=="))

For Each sh In msheetsarray
With sh
.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
.Outline.ShowLevels RowLevels:=1
End With
Next

Sheets("Sheet1").Select
Range("B4").Select

End Sub

It loops through the sheets but doesn't actually do anything! When i
recorded the macro, there was an "activesheet." before the "outline"
above, but the vba commander wasn't liking that...

Any suggestions?

Cheers