![]() |
Pass word protecting multipul worksheets within a workbook
is there a way to pass word protect multiful worksheets within a workbook at
the same time. i have several workbooks that have 5-35 worksheets that all need pass word protected and would like to do it all at the same time. |
Pass word protecting multipul worksheets within a workbook
This will do it
Sub Macro1() Dim strPassword As String Dim mySheet As Worksheet For Each mySheet In Worksheets strPassword = InputBox("Enter the password for the worksheet") mySheet.Protect Password:=strPassword, Scenarios:=True Next End Sub If you wish to use a single password Sub Macro1() Dim strPassword As String Dim mySheet As Worksheet strPassword = InputBox("Enter the password for the worksheet") For Each mySheet In Worksheets mySheet.Protect Password:=strPassword, Scenarios:=True Next End Sub Need hep with VBA? David McRitchie's site on "getting started" with VBA http://www.mvps.org/dmcritchie/excel/getstarted.htm Happy New Year -- Bernard V Liengme Microsoft Excel MVP www.stfx.ca/people/bliengme remove caps from email "Terrie" wrote in message ... is there a way to pass word protect multiful worksheets within a workbook at the same time. i have several workbooks that have 5-35 worksheets that all need pass word protected and would like to do it all at the same time. |
All times are GMT +1. The time now is 05:04 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com