Hello to all!
Here is the task.
For example I want to make my own sheet protection from macros.
I Write such code in Sheet 1:
As you see – if user try to change text in any cell, or paste values the program shows a mistake. BUT!
It doesn’t work in the case when user select one or more cells and drag then into others.
What I mean drag? I mean that you put mouse to be border on the cell, click left button down and then drug the context of the cells into other position.
This code execute twice – I don’t understand why?
I think you will see it if you try…
Have any ideas to make this macros worked right in all cases?
Here is the task.
For example I want to make my own sheet protection from macros.
I Write such code in Sheet 1:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
MsgBox "You can't do it!"
Application.Undo
Application.EnableEvents = True
End Sub
As you see – if user try to change text in any cell, or paste values the program shows a mistake. BUT!
It doesn’t work in the case when user select one or more cells and drag then into others.
What I mean drag? I mean that you put mouse to be border on the cell, click left button down and then drug the context of the cells into other position.
This code execute twice – I don’t understand why?
I think you will see it if you try…
Have any ideas to make this macros worked right in all cases?