ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   modify macro to include more tabs (https://www.excelbanter.com/excel-discussion-misc-queries/258691-modify-macro-include-more-tabs.html)

teh_chucksta

modify macro to include more tabs
 
Hi,

The macro below allows users to group/ungroup rows in a protected sheet. How
do I modify this macro to either incorporate more worksheets or apply it to
the entire workbook?

Thanks,
Charlie


Sub workbook_open()
With Worksheets("Sheet1")
.Protect Password:="password", userinterfaceonly:=True
.EnableOutlining = True
End With
End Sub


Billy Liddel

modify macro to include more tabs
 
Try something like this, not tested

Sub workbook_open()
Dim wks as worksheet

For each wks in Activeworkbook
With wks)
.Protect Password:="password", userinterfaceonly:=True
.EnableOutlining = True
End With
next wks
End Sub

HTH
Peter

"teh_chucksta" wrote:

Hi,

The macro below allows users to group/ungroup rows in a protected sheet. How
do I modify this macro to either incorporate more worksheets or apply it to
the entire workbook?

Thanks,
Charlie


Sub workbook_open()
With Worksheets("Sheet1")
.Protect Password:="password", userinterfaceonly:=True
.EnableOutlining = True
End With
End Sub



All times are GMT +1. The time now is 01:27 PM.

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