Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Protect / Unprotect Sheets

Hi

Can anyone provide two simple macros to protect all sheets
in a workbook, and the opposite - i.e. unprotect all
sheets?

Ideally, I'd then like to move on to designing a form that
lists all the worksheets that I can toggle protection or
or off from. But first things first!

Thanks

Rob F
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Protect / Unprotect Sheets

Hello Rob
Sub Protect()
For Each f In Sheets
f.Protect '("pwd") optional if password
Next f
End Sub

Sub Unprotect()
For Each f In Sheets
f.Unprotect '("pwd") optional if password
Next f
End Sub

HTH
Cordially
Pascal

"Rob F" a écrit dans le message de
...
Hi

Can anyone provide two simple macros to protect all sheets
in a workbook, and the opposite - i.e. unprotect all
sheets?

Ideally, I'd then like to move on to designing a form that
lists all the worksheets that I can toggle protection or
or off from. But first things first!

Thanks

Rob F



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Protect / Unprotect Sheets

Pascal

Great, does just what I want.

Thanks

Rob
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Protect / Unprotect Sheets

Sub toggleprotect()
With ActiveSheet
If .ProtectContents = True Then
.Unprotect
Else
.Protect
End If
End With
End Sub


--
Don Guillett
SalesAid Software

"Rob F" wrote in message
...
Hi

Can anyone provide two simple macros to protect all sheets
in a workbook, and the opposite - i.e. unprotect all
sheets?

Ideally, I'd then like to move on to designing a form that
lists all the worksheets that I can toggle protection or
or off from. But first things first!

Thanks

Rob F



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protect/Unprotect Multiple Sheets With Full Options TEK Excel Discussion (Misc queries) 4 February 11th 09 02:56 PM
Protect/unprotect all sheets at once? wx4usa New Users to Excel 4 July 22nd 08 12:08 AM
Protect-Unprotect all the sheets Gary Excel Worksheet Functions 7 February 26th 07 08:13 PM
Macros for Protect/Unprotect all sheets in a workbook Paul Sheppard Excel Discussion (Misc queries) 2 August 4th 05 04:30 PM
Protect/Unprotect Sheets Deeds[_2_] Excel Programming 1 May 27th 04 08:43 PM


All times are GMT +1. The time now is 04:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"