Lock Cell After Data Entry

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 
Back
Top