![]() |
Unprotect question.
In response to a recent posting, JulieD helped out someone with a script to
unprotect and the protect a worksheet. It works great for me, except for one thing. When I go up to unprotect the worksheet, it doesn't prompt me for a password. I've checked VB help, but still cannot find a solution. Below is her script and the script I used to incorporate hers. Any help would be appreciated :) _JulieD ThisWorkbook.Worksheets("Sheet1).Unprotect("YourPa ssword") ThisWorkbook.Worksheets("Sheet1).Protect("YourPass word") _Mine Sub unpro_pro() Range("B2").Select Worksheets("sheet1").Unprotect Password:="YourPassword" ActiveCell.FormulaR1C1 = "=R[1]C[4]" Range("B2").Select ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True Worksheets("sheet1").Protect Password:="YourPassword" End Sub |
Unprotect question.
Hi
Instead of this, Sub unpro_pro() Range("B2").Select Worksheets("sheet1").Unprotect Password:="YourPassword" ActiveCell.FormulaR1C1 = "=R[1]C[4]" Range("B2").Select ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True Worksheets("sheet1").Protect Password:="YourPassword" End Sub Try it like this Sub unpro_pro() Range("B2").Select Worksheets("sheet1").Unprotect Password:="YourPassword" ActiveCell.FormulaR1C1 = "=R[1]C[4]" Range("B2").Select Worksheets("sheet1").Protect Password:="YourPassword", DrawingObjects:=True, Contents:=True, Scenarios:=True End Sub I didn't check the Protect syntax for the order of the items following protect, but it seemed to work for me. HTH Ken |
Unprotect question.
To explain, basically when you tried to protect the sheet with a password,
the line before had already protected the sheet with no password. Hence no password box if you clicked tools, unprotect sheet, because there was no password. Ken |
Unprotect question.
Problem fixed! Thanks so much, Ken!
|
Unprotect question.
You are welcome
Ken |
All times are GMT +1. The time now is 03:42 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com