I have am Excel document with reasonably complex conditional formatting. The user group is not conversant with spreadsheets, mostly using them as a way to make text line up in tables, so I can't rely on training to Paste Special Values; if ctrl-v doesn't do it, it's not happening. Likewise modifying my instance of Excel with Quick Access or similar.
I've gotten as far as a simple VBA Macro to which I can remap ctrl-v. There are two single line commands that work - but each for only a given type of content. This is the macro:
Sub paste_value()
'
' paste_value Macro
' paste value only, preserving format
'
' Keyboard Shortcut: Ctrl+v
'
ActiveSheet.PasteSpecial Format:="Text", Link:=False, DisplayAsIcon:= _
False
Selection.PasteSpecial Paste:=xlPasteValues
End Sub
ActiveSheet.PasteSpecial works if the clipboard holds text, most often from another program, but Selection.PasteSpecial throws run-time error 1004.
Selection.PasteSpecial works if the clipboard holds an Excel range, but ActiveSheet.PasteSpecial throws run-time error 1004.
A test to see what's on the clipboard and choose the appropriate command could work, but I've no idea how to go about that test. Some quick googling makes it seem a daunting task that might interfere with the clipboard itself.
Also open to any other methods that work.
Try this code: