Thread: Grouping
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Grouping



Nope..

"grouping" sheets is in fact selecting multiple sheets.
a hidden sheet cannot be selected...

But you can fake it. However be very careful reselecting or
reactivating = the moment you activate a grouped sheet when the
selectedsheets collection contains a hidden sheet, the selectedsheets
collection is reset.


Sub demoPrep()
Dim lTmp
lTmp = Application.SheetsInNewWorkbook
Application.SheetsInNewWorkbook = 10
Workbooks.Add
Application.SheetsInNewWorkbook = lTmp

Worksheets(Array(2, 3, 4, 5, 6, 7, 8, 9)).Visible = False

End Sub

Sub groupEdit()

Dim alVis() As Long
Dim lAct As Long


lAct = ActiveSheet.Index
ReDim alVis(1 To Worksheets.Count)

For n = 1 To Worksheets.Count
alVis(n) = Worksheets(n).Visible
Worksheets(n).Visible = True
Next

Worksheets(lAct).Activate
Worksheets.Select

For n = 1 To Worksheets.Count
Worksheets(n).Visible = alVis(n)
Next

MsgBox ActiveWindow.SelectedSheets.Count


Range("a4").Select
Selection.Value = 4

Range("a3").Formula = "=sum(" & _
Worksheets(1).Name & ":" & _
Worksheets(Worksheets.Count).Name & "!a4)"




End Sub






--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Peter wrote :

Hi All,
Is it possible to group visible and hidden sheets?
If so, how?

Any info appreciated
Regards
Peter