-- Is it possible to protect/unprotect all worksheets in a workbook at once
instead of having to do each individually if the password is the same?
News Gal
-- Is it possible to protect/unprotect all worksheets in a workbook at once
instead of having to do each individually if the password is the same?
News Gal
The only way to do that is with some VBA code:
Sub ProtectAll()
Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
WS.Protect Password:="whatever"
Next WS
End Sub
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Newsgal" <[email protected]> wrote in message
news:[email protected]...
>
> -- Is it possible to protect/unprotect all worksheets in a
> workbook at once
> instead of having to do each individually if the password is
> the same?
>
> News Gal
The only way is to use a macro to do this
Sub test()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
sh.Unprotect "ron"
Next sh
End Sub
Or
sh.Protect "ron"
--
Regards Ron de Bruin
http://www.rondebruin.nl
"Newsgal" <[email protected]> wrote in message news:[email protected]...
>
> -- Is it possible to protect/unprotect all worksheets in a workbook at once
> instead of having to do each individually if the password is the same?
>
> News Gal
This macro would do the trick
Sub Unprotect()
Dim wb As Workbook
Dim ws As Worksheet
Dim blnIsProtected As Boolean
Set wb = ActiveWorkbook
For Each ws In wb.Worksheets
ws.Unprotect "test"
Next ws
Set wb = Nothing
Set ws = Nothing
End Sub
--
Kevin Backmann
"Newsgal" wrote:
>
> -- Is it possible to protect/unprotect all worksheets in a workbook at once
> instead of having to do each individually if the password is the same?
>
> News Gal
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks