Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unprotect question.
Problem fixed! Thanks so much, Ken!
|
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unprotect question.
You are welcome
Ken |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unprotect in a macro | Excel Discussion (Misc queries) | |||
Unprotect a worksheet | New Users to Excel | |||
Unprotect worksheet via VBA | Excel Worksheet Functions | |||
Unprotect | Excel Discussion (Misc queries) | |||
Unprotect workbook | Excel Programming |