Protect sheet

Nasser
StarLounger
Posts: 56
Joined: 11 May 2010, 10:26

Protect sheet

Post by Nasser »

Hi,

Hi,

I have used "drop down" in my program. After protecting my sheet and clicking on the drop-down, an error is coming" Run-time error '1004'

The cell or chart that you are trying to change is protected and therefore read-only.

When i remove the protection, the drop-down is working. The thing that i want to protect my sheet and be able to run the drop-down.

Similar error is coming with : SpinButton" and some empty cells to be fitted with data in other programs.

Example of

Sub DropDown2_Change()
Dim x As Integer
x = Range("R10").Value
If x = 1 Then
ActiveSheet.Shapes("rectangle 100").Fill.ForeColor.SchemeColor = 1
ActiveSheet.Shapes("rectangle 99").Visible = False
ActiveSheet.Shapes("rectangle 92").Visible = False

Else
ActiveSheet.Shapes("rectangle 100").Fill.ForeColor.SchemeColor = 0

End If
End Sub

Thanks,
Nasser.

User avatar
rory
5StarLounger
Posts: 817
Joined: 24 Jan 2010, 15:56

Re: Protect sheet

Post by rory »

Are your controls linked to cells on the sheet? If so, those cells need to be unlocked.
Regards,
Rory

Nasser
StarLounger
Posts: 56
Joined: 11 May 2010, 10:26

Re: Protect sheet

Post by Nasser »

Hi,

Yes, you are right. It's now working, thank uuuuuu :)

Regards,
Nasser.

Nasser
StarLounger
Posts: 56
Joined: 11 May 2010, 10:26

Re: Protect sheet

Post by Nasser »

Hi,

There is only thing which i am missing to protect my sheet.

Now my sheet is protected from the user but there is one thing which is not locked, it is the VISUAL BASIC PROGRAM. The user can easily click on "Visual Basic" icon and can access the code. How to block the user to not open the visual basic so that the program is safe.

Thanks,
Nasser.

User avatar
rory
5StarLounger
Posts: 817
Joined: 24 Jan 2010, 15:56

Re: Protect sheet

Post by rory »

You can protect the code in the VBProject under the Tools-VBA Project properties dialog, but just be aware that, like worksheet protection, it's not really secure. It will deter a casual user, but no more.
Regards,
Rory

Nasser
StarLounger
Posts: 56
Joined: 11 May 2010, 10:26

Re: Protect sheet

Post by Nasser »

Hi Rory,

My VBA is not really sensitive. I just dont want the user to change any data or disturb the program. Now i am happy now with this protection. Thanks

I dont understand one thing. Why they put a password and give the option to lock for viewing the project? If i lock it that's fine, the user can not see even the project but the other option is not clear. Means i dont lock the project for viewing but i put the password. The user can still edit the code and change the thing. Where is then the protection?

Thank you.
Nasser.

User avatar
HansV
Administrator
Posts: 78468
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Protect sheet

Post by HansV »

The two belong together. The password only becomes effective if you tick the check box to lock the project for viewing.
Best wishes,
Hans

Nasser
StarLounger
Posts: 56
Joined: 11 May 2010, 10:26

Re: Protect sheet

Post by Nasser »

Now it becomes clear,

Thanks Hans,
Nasser.