Hi All,
I have two buttons on a spreadsheet ("Lock All" and "Unlock All") that I would like to password protect (for our purposes, let's say the password will be "stock"). Can't find any good resources online on how to do this. Anyone have any thoughts?
Thanks,
Jim
*Here's the code attached to the two buttons*
Sub LockAll()
Application.ScreenUpdating = False
ActiveWorkbook.Unprotect "stock"
ActiveSheet.Unprotect "stock"
Sheets("Data").Visible = False
Sheets("Schedule").Visible = False
ActiveSheet.Protect "stock"
ActiveWorkbook.Protect "stock"
Application.ScreenUpdating = True
End Sub
Sub UnlockAll()
Application.ScreenUpdating = False
ActiveWorkbook.Unprotect "stock"
ActiveSheet.Unprotect "stock"
Sheets("Data").Visible = True
Sheets("Schedule").Visible = True
End Sub
I have two buttons on a spreadsheet ("Lock All" and "Unlock All") that I would like to password protect (for our purposes, let's say the password will be "stock"). Can't find any good resources online on how to do this. Anyone have any thoughts?
Thanks,
Jim
*Here's the code attached to the two buttons*
Sub LockAll()
Application.ScreenUpdating = False
ActiveWorkbook.Unprotect "stock"
ActiveSheet.Unprotect "stock"
Sheets("Data").Visible = False
Sheets("Schedule").Visible = False
ActiveSheet.Protect "stock"
ActiveWorkbook.Protect "stock"
Application.ScreenUpdating = True
End Sub
Sub UnlockAll()
Application.ScreenUpdating = False
ActiveWorkbook.Unprotect "stock"
ActiveSheet.Unprotect "stock"
Sheets("Data").Visible = True
Sheets("Schedule").Visible = True
End Sub