Protected worksheet allows editing cell format by copying and pasting

I have a worksheet that is protected. Only some cells are editable, and the user can write to them, but cannot change the cell format as usual. If he decides to copy and paste data from another sheet to mine, then the cell formatting of another sheet is applied to my cells. I want my cells to be editable, but their cell format should not be editable at all! How can i do this?

Thanks in advance!

Marco

+3
source share
2 answers

, , , :

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

    If Application.CutCopyMode = xlCopy Then

        Application.EnableEvents = False

        Application.Undo
        Target.PasteSpecial Paste:=xlPasteValues

        Application.EnableEvents = True

    End If

End Sub

( , ).

+3

workheet_change, , - :

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = Range("J2").Address Then
        'your code
    End If
End Sub

, .

+1

All Articles