Password Change

K

Khalil Handal

A worksheet has password created using the "Tools" -> "Protection".
Inside the sheet there is a check box. It has a VBA Code as follows:

Private Sub CheckBox1_Click()
Me.Unprotect Password:="1230"
If CheckBox1.Value = True Then
Me.Range("C34:I35").Font.Color = vbBlack
Else
Me.Range("C34:I35").Font.Color = vbWhite
End If
Me.Protect Password:="1230"
ActiveSheet.Protect AllowFormattingRows:=True
End Sub

I changed the password in the code to: 2130 (an example).
My problem is when I go to the "Protection" in the Tools Menu and choose the
"unprotect" It does not ask me for the password.
It is automatically unprotected.

I tried to use the same password from the VB Code and the Tools Menu and
still has the same problem: It unprotect the sheet without asking for the
Password.

I am using Excel 2003
Any Suggestions!
 
J

John Bundy

depends on where this checkbox is, if it is in a form, the me.xxx is
referring to the form, try using application or workbook or sheet depending
on which you are trying to protect.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top