View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Peter Hill Peter Hill is offline
external usenet poster
 
Posts: 2
Default Simple password function - unprotecting sheets

Hello,
I have a problem where I have 1 protected cell on a sheet.
It is at the top of the sheet and it is for a 'supervisor'
to enter his name to say that he has checked the sheet.
Only the supervisor has the password to unprotect the
sheet so he can enter data into that protected cell.
Unfortunately, sometimes the people filling out the sheet
are wanting to insert extra rows, which I want them to be
able to do, but they can't because the sheet is protected.
So - I tried putting a command button on the sheet that
would unprotect the sheet, insert the desired number of
rows, then protect the sheet again
eg. {I don't mind that they can see the password in here
at the moment}

Dim Row_Count As Integer
Dim password
password = "checked"
ActiveSheet.Unprotect password
Row_Count = InputBox("Enter number of rows required.")
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset
(Row_Count - 1, 0)).Select
Selection.EntireRow.Insert
ActiveSheet.Protect password, True, True, True

Unfortunately, when I try this, I get the following error:
"Unprotect method of worksheet class failed"

I can guess why - password.

Can anyone suggest as alternative way of having the sheet
unprotected so that rows can be inserted, yet that cell
still protected - even by a simple password for that
single cell?