ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Only allow users to edit in sheet, not delete any entries entered (https://www.excelbanter.com/excel-discussion-misc-queries/238986-only-allow-users-edit-sheet-not-delete-any-entries-entered.html)

rrupp

Only allow users to edit in sheet, not delete any entries entered
 
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.


Otto Moehrbach[_2_]

Only allow users to edit in sheet, not delete any entries entered
 
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
"rrupp" wrote in message
...
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.




rrupp

Only allow users to edit in sheet, not delete any entries entered
 
Thank you very much!

"rrupp" wrote:

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.


Otto Moehrbach[_2_]

Only allow users to edit in sheet, not delete any entries entered
 
Thanks for the feedback. Otto
"rrupp" wrote in message
...
Thank you very much!

"rrupp" wrote:

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.




BlackViking

Quote:

Originally Posted by Otto Moehrbach[_2_] (Post 865291)
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
"rrupp" wrote in message
...
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.


Can you explain how to run this macro? I have the same problem but I did put the code and nothing happens.
Thanks.


All times are GMT +1. The time now is 06:23 PM.

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