Forum Discussion
Excel worksheet permissions
I will need to do some pretty extensive research into VBA before I tackle this.
Not at all familiar with coding.
Thanks for the info.
MstrV actually it isn't hard:
open the workbook and click alt-F11 (opens VBA window)
on left expand your VBAProject (yourworkbookname.xlsm) (NOTE: you will need to make sure your workbook is saved as a format that allows macros like .xlsm or .xlsb)
expand Microsoft Excel objects
double-click on ThisWorkbook (should open code window to the right)
in the code window you basically want:
Public Const PW = "your password"
Private Sub Workbook_Open()
if Application.UserName="user's name" then
ActiveWorkbook.Unprotect (PW)
ActiveWorkbook.Sheets("sheet name").Unprotect (PW)
end if
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Protect (PW)
ActiveWorkbook.Sheets("sheet name").Protect (PW)
NOTE: I used the same password for both protecting the workbook and the sheet
NOTE2: I assumed 1 sheet. If you have more sheets you can use a loop or a For Each statement.