ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro code mod - add tabs/apply to entire workbook (https://www.excelbanter.com/excel-programming/440517-macro-code-mod-add-tabs-apply-entire-workbook.html)

teh_chucksta

Macro code mod - add tabs/apply to entire workbook
 
Hi,

The macro below allows users to group/ungroup rows in a protected sheet.
Question: how to modify the VB code so I can incorporate additional tab names
or better yet, have the macro apply to the entire workbook?

Thanks in advance for your help,
Charlie


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




Bob Phillips[_4_]

Macro code mod - add tabs/apply to entire workbook
 

Sub workbook_open()
For Each sh In Activeworkbook.Worksheets
With sh
.Protect Password:="xlhelp", userinterfaceonly:=True
.EnableOutlining = True
End With
Next sh
End Sub


--

HTH

Bob

"teh_chucksta" wrote in message
...
Hi,

The macro below allows users to group/ungroup rows in a protected sheet.
Question: how to modify the VB code so I can incorporate additional tab
names
or better yet, have the macro apply to the entire workbook?

Thanks in advance for your help,
Charlie


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






Per Jessen

Macro code mod - add tabs/apply to entire workbook
 
Hi

Try this:

Sub workbook_open()
for each sh in thisworkbook.sheets
if sh.name<"NotThisSheet" then
With sh
.Protect Password:="xlhelp", userinterfaceonly:=True
.EnableOutlining = True
End With
end if
next
End Sub

Regards,
Per

"teh_chucksta" skrev i meddelelsen
...
Hi,

The macro below allows users to group/ungroup rows in a protected sheet.
Question: how to modify the VB code so I can incorporate additional tab
names
or better yet, have the macro apply to the entire workbook?

Thanks in advance for your help,
Charlie


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





All times are GMT +1. The time now is 10:07 AM.

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