Not recommended as it disables CTRL+Z, which is why I did mine for CTRL+SHIFT+V
Application.OnKey
in ThisWorkbook
Private Sub Workbook_Open()
Application.OnKey "+^v", "Pval"
' Application.OnKey "^{INSERT}", "Pval"
End Sub
in a module
'paste by value with shift+ctrl+v
Public Sub Pval()
Dim s As Range: Set s = Selection
If Application.CutCopyMode = False Then GoTo PasteNorm
Application.ScreenUpdating = False
On Error GoTo PasteErr
s.PasteSpecial Paste:=xlPasteValues, SkipBlanks:=True, Transpose:=False
' s.PasteSpecial Paste:=xlPasteFormats, SkipBlanks:=True, Transpose:=False
' s.PasteSpecial Paste:=xlPasteComments, SkipBlanks:=True, Transpose:=False
On Error GoTo 0
Application.ScreenUpdating = True
Exit Sub
PasteNorm:
On Error GoTo PasteNormErr
s.PasteSpecial
On Error GoTo 0
s.WrapText = False
'Selection.EntireColumn.AutoFit
EOFn: Application.ScreenUpdating = True
Exit Sub
PasteErr:
'MsgBox Err.Description
Resume PasteNorm
PasteNormErr:
If Err = 1004 Then
Beep
On Error GoTo 0
Resume EOFn
End If
On Error GoTo 0
Resume
End Sub
Note this solution also relies on knowing how the end user pastes their data, they could just as easily right-click and paste, SHIFT+INS paste...
Bookmarks