ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protecting worksheet. (https://www.excelbanter.com/excel-programming/446869-protecting-worksheet.html)

[email protected]

Protecting worksheet.
 
I have used the following code to protect a worksheet while leaving certain cells unprotected.

Range("bi" & RowNum & ":cn" & UnprotectLastRow).Locked = False
Range("bk" & RowNum & ":bw" & UnprotectLastRow).Locked = True

ActiveSheet.Protect Password = "guru11"

I would like the manager to be able to unprotect the workbook within Excel. When I go into Review--Unprotect sheet. It asks for a password. I provide the password above and it doesn't like it.

Am I going to the wrong place for this?

If so, where should I go?

If not, what do I need to do?

Thanks in Advance

Rich

[email protected]

Protecting worksheet.
 
Rich,

You are missing a colon after Password. This line worked for me:

ActiveSheet.Protect Password:="guru11"

-Ben


All times are GMT +1. The time now is 09:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com