I have no VBA experience, but was in need of being able to paste into cells without the formatting changing. I found this script in a thread here:
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
I added this macro to my excel file and I thought it was working at first. However, after further testing it only seems to work half the time and I can't figure out why. I make sure to have macros enabled every time I have tested it. What could cause this to work sometimes and then not work at other times?