Hi,
I have one sheet where almost all cells execute some macros by Worksheet_change event.
Therefore I need to prevent all actions where user can change more than one cell at the time.
I am going to use the code:
It works (I think so) for attempts of delete as well as paste in many cells at the same time but the problem is when user will cut several cells. The message box appears only when cutted cells are pasted to other. So the Application.Undo works duringe the paste action and the second time when inserting oryginal values in the correct places.
At the end all is messed up.
How can I prevent then?
Is there something else that I did not consider that can brake my idea due to any unexpected user actions?
I have one sheet where almost all cells execute some macros by Worksheet_change event.
Therefore I need to prevent all actions where user can change more than one cell at the time.
I am going to use the code:
Code:
Private Sub Worksheet_Change (byVal Target As Range)
If Target.Cells.Count > 1 Then
Application.EnableEvents = False
Application.Undo
Msgbox "Not allowed action !"
Application.EnableEvents = True
Exit Sub
End If
....
....
End Sub
It works (I think so) for attempts of delete as well as paste in many cells at the same time but the problem is when user will cut several cells. The message box appears only when cutted cells are pasted to other. So the Application.Undo works duringe the paste action and the second time when inserting oryginal values in the correct places.
At the end all is messed up.
How can I prevent then?
Is there something else that I did not consider that can brake my idea due to any unexpected user actions?
Last edited: