Forum

Notifications
Clear all

Protecting Multiple Worksheets

4 Posts
2 Users
0 Reactions
67 Views
(@benjamip)
Posts: 89
Estimable Member
Topic starter
 

Hi There,

I have a workbook that contains 11 worksheets, I have hidden columns on all 11 and want to protect each sheet so users can not un-hide the columns.

I know how to protect an individual worksheet, is there a way to protect all 11 worksheets in one go?

Thanks

Paul

 
Posted : 03/10/2017 1:07 pm
(@kingtamo)
Posts: 13
Active Member
 

Hello

Try this code

Sub Test()
Dim ws As Worksheet

For Each ws In ThisWorkbook.Worksheets
ws.Protect "123" 'Change 123 to your password
Next ws
End Sub 

 
Posted : 03/10/2017 1:19 pm
(@benjamip)
Posts: 89
Estimable Member
Topic starter
 

Thanks

 
Posted : 04/10/2017 5:45 am
(@kingtamo)
Posts: 13
Active Member
 

You're welcome. Glad I can offer some help

 
Posted : 04/10/2017 8:45 am
Share: