Lock Cell After Data Entry

R

Ripper

Is there a way to lock a cell from edit or delete after a person has entered
data into it?

I am using Excel as a survey tool in a class. Each student will create a
survey and then the students will rotate around the lab and take each
student's survey. I don't want a student messing with the former student's
data by changing the answer. Therefore I need to lock or hide the answer
after the student entered it.
 
P

Paul B

Ripper, you could some code in the sheet module, right click on the sheet
tab view code like this,

Private Sub Worksheet_Change(ByVal Target As Range)

'Automatically Protecting After Input

'unlock all cells in the range first
Dim MyRange As Range

Const Password = "123" '**Change password here**

Set MyRange = Intersect(Range("A1:B10,C5"), Target) '**change range
here**

If Not MyRange Is Nothing Then

Unprotect Password:=Password

MyRange.Locked = True

Protect Password:=Password

End If

End Sub
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 

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