When you look at the project tree in the code editor, you should see a module called "ThisWorkbook" which is where the code should be, if you put it anywhere else then it won't run when you open the file. Private Sub Workbook_BeforeClose(Cancel As Boolean)ĪctiveWorkbook.Sheets("Sheet1").Protect Password:="your password"Īs you're new to this, something else that might not be instantly obvious is the correct place to put the code. If Environ("username") = "manny1" Or Environ("username") = "Anna" ThenĪctiveWorkbook.Sheets("Sheet1").Unprotect Password:="your password"
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |