Only allow users to edit in sheet, not delete any entries entered

R

rrupp

Is there a way to protect data in Excel so users can enter information but
not delete information that has been entered by other users in the cell. In
other words, I'll be distributing a document for users to edit, I want to
protect it so users who have entered data, cannot have someone else delete
what they entered. Any easy way to do this?

Thanks for your time.
 
O

Otto Moehrbach

You can use a Worksheet_Change event macro that will prevent ANY entry other
than a blank cell from being changed. Something like the following. Note
that this macro must be placed in the sheet module of the pertinent sheet.
HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
Dim CountAfter As Long
If Target.Count > 1 Then
CountAfter = Application.CountA(Target)
Application.EnableEvents = False
If CountAfter = 0 Then
Application.Undo
MsgBox "Clearing of cells is not permitted.", 16, "ERROR"
End If
Application.EnableEvents = True
Exit Sub
End If
If IsEmpty(Target.Value) Then
Application.EnableEvents = False
Application.Undo
MsgBox "Clearing of cells is not permitted.", 16, "ERROR"
Application.EnableEvents = True
End If
End Sub
 

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