Hello:
I needed some help, I am trying to create a macro to protect sheets within the workbook file. below code is what I used but it is not working. I would keep this file open then go into each seperate workbook file to protect all the sheets in the file. Also I added a ctrl a to protect and ctl key r to unprotect the file. key Any help would be appreciated:
Sub AA___Protect_All_FY14_Calc_Sheets()
'AProtect All Calc Sheets Macro
'FY13 password is "test", macro must be updated to include "FY13" in array to function
Dim ws As Worksheet
Set WSArray = Sheets(Array("Census", "Emp_Data_7_1_13"))
Set WSArray = Sheets(Array("Calc Sheet (1)", "Calc Sheet (2)", "Calc Sheet (3)", "Calc Sheet (4)", "Calc Sheet (5)", "Calc Sheet (6)", "Calc Sheet (7)", "Calc Sheet (8)", "Calc Sheet (9)", "Calc Sheet (10)", "Calc Sheet (11)", "Calc Sheet (12)", "Calc Sheet (13)", "Calc Sheet (14)", "Calc Sheet (15)", "Calc Sheet (16)", "Calc Sheet (17)", "Calc Sheet (18)", "Calc Sheet (19)", "Calc Sheet (20)", "Calc Sheet (21)", "Calc Sheet (22)", "Calc Sheet (23)", "Calc Sheet (24)", "Calc Sheet (25)", "Calc Sheet (26)", "Calc Sheet (27)", "Calc Sheet (28)", "Calc Sheet (29)", "Calc Sheet (30)", "Calc Sheet (31)", "Calc Sheet (32)", "Calc Sheet (33)", "Calc Sheet (34)", "Calc Sheet (35)", "Calc Sheet (36)", "Calc Sheet (37)", "Calc Sheet (38)", "Calc Sheet (39)", "Calc Sheet (40)", "Calc Sheet (41)"))
Set WSArray = Sheets(Array("Calc Sheet (42)", "Calc Sheet (43)", "Calc Sheet (44)", "Calc Sheet (45)", "Calc Sheet (46)", "Calc Sheet (47)", "Calc Sheet (48)", "Calc Sheet (49)", "Calc Sheet (50)", "Calc Sheet (51)", "Calc Sheet (52)", "Calc Sheet (53)", "Calc Sheet (54)", "Calc Sheet (55)", "Calc Sheet (56)", "Calc Sheet (57)", "Calc Sheet (58)", "Calc Sheet (59)", "Calc Sheet (60)", "Calc Sheet (61)", "Calc Sheet (62)", "Calc Sheet (63)", "Calc Sheet (64)"))
For Each ws In WSArray
ws.Protect Password:="test1", DrawingObjects:=True, Contents:=True, Scenarios:=True
Next ws
End Sub
Sub AA___UnProtect_All_FY14_Calc_Sheet()
'UnProtect All Budget Sheets Macro
Dim ws As Worksheet
'Set WSArray = Sheets(Array("census", "Emp_Data_7_1_13"))
Set WSArray = Sheets(Array("Census", "Emp_Data_7_1_13"))
Set WSArray = Sheets(Array("Calc Sheet (1)", "Calc Sheet (2)", "Calc Sheet (3)", "Calc Sheet (4)", "Calc Sheet (5)", "Calc Sheet (6)", "Calc Sheet (7)", "Calc Sheet (8)", "Calc Sheet (9)", "Calc Sheet (10)", "Calc Sheet (11)", "Calc Sheet (12)", "Calc Sheet (13)", "Calc Sheet (14)", "Calc Sheet (15)", "Calc Sheet (16)", "Calc Sheet (17)", "Calc Sheet (18)", "Calc Sheet (19)", "Calc Sheet (20)", "Calc Sheet (21)", "Calc Sheet (22)", "Calc Sheet (23)", "Calc Sheet (24)", "Calc Sheet (25)", "Calc Sheet (26)", "Calc Sheet (27)", "Calc Sheet (28)", "Calc Sheet (29)", "Calc Sheet (30)", "Calc Sheet (31)", "Calc Sheet (32)", "Calc Sheet (33)", "Calc Sheet (34)", "Calc Sheet (35)", "Calc Sheet (36)", "Calc Sheet (37)", "Calc Sheet (38)", "Calc Sheet (39)", "Calc Sheet (40)", "Calc Sheet (41)"))
Set WSArray = Sheets(Array("Calc Sheet (42)", "Calc Sheet (43)", "Calc Sheet (44)", "Calc Sheet (45)", "Calc Sheet (46)", "Calc Sheet (47)", "Calc Sheet (48)", "Calc Sheet (49)", "Calc Sheet (50)", "Calc Sheet (51)", "Calc Sheet (52)", "Calc Sheet (53)", "Calc Sheet (54)", "Calc Sheet (55)", "Calc Sheet (56)", "Calc Sheet (57)", "Calc Sheet (58)", "Calc Sheet (59)", "Calc Sheet (60)", "Calc Sheet (61)", "Calc Sheet (62)", "Calc Sheet (63)", "Calc Sheet (64)"))
For Each ws In WSArray
ws.Unprotect Password:="test1"
Next ws
End Sub