ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Lock Cell After Data Entry (https://www.excelbanter.com/excel-discussion-misc-queries/74439-lock-cell-after-data-entry.html)

Ripper

Lock Cell After Data Entry
 
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.
--
Thanks As Always
Rip

Paul B

Lock Cell After Data Entry
 
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


"Ripper" wrote in message
...
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.
--
Thanks As Always
Rip





All times are GMT +1. The time now is 11:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com