I am trying to make it so if the user copies & pastes anything in my workbook, it will only do a Paste Values. I found an answer to a post on Stack Exchange from a few ago that recommending putting the following code in the Workbook_SheetChange sub.
The problem is, on certain sheets, it doesn't seem to run. If I press Ctrl-C with a cell selected on one worksheet within my workbook, then change to another sheet in my workbook, and then press Ctrl-V in a cell there, it doesn't paste only the values -- it does a normal paste. I don't understand why this is happening on certain sheets but on others it doesn't. Any ideas what might be causing this?
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Application.CutCopyMode = xlCopy Then
Application.EnableEvents = False
Application.Undo
Target.PasteSpecial Paste:=xlPasteValues
Application.EnableEvents = True
End If
End Sub
The problem is, on certain sheets, it doesn't seem to run. If I press Ctrl-C with a cell selected on one worksheet within my workbook, then change to another sheet in my workbook, and then press Ctrl-V in a cell there, it doesn't paste only the values -- it does a normal paste. I don't understand why this is happening on certain sheets but on others it doesn't. Any ideas what might be causing this?