ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Grouping (https://www.excelbanter.com/excel-programming/324386-grouping.html)

Peter

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

Any info appreciated
Regards
Peter

keepITcool

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



All times are GMT +1. The time now is 04:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com