Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help, in a Protection Quandary

Status
Not open for further replies.

ChrisBEE1

Technical User
Feb 1, 2003
2
US
Hi All,

I am in a quandary over how to implement cell protection. It is common knowledge that for protection to work the cells must be locked and the worksheet protected. Well, when I try to implement cell protection using the following code:

Sub Worksheet_Activate
ActiveSheet.Protect UserInterfaceOnly:=True, password:="password"
End Sub

Either the target cells remain locked and a "Run-time error 1004' occurs and the macro stops, or the macro executes and leaves the target cells unlocked (and I'd like them to be locked with the macro has executed).

Can anyone shed light on this quandary? How can I acheive my objective of protecting the cell contents? It has been suggested that I set the sheets scroll area, however, this solution does not work for my situation.

Also, is there a way to lock cell after it has been unprotected?

Any help that I could get on this will be greatly appreciated!

Thanks,
Chris
 
What are you using as a spreadsheet control?

Perhaps asking folks in a more targeted forum would get more results (a ColdFusion forum might not be the most appropriate since it looks like you're using ASP/VB). Hope it helps,
-Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top