MatthewNYC
New Member
- Joined
- Feb 19, 2017
- Messages
- 18
Hi,
I am hooking into the CTRL + V paste shortcut with the following code and redirecting it to my custom "PasteAsValues" procedure:
Application.OnKey "^v", "PasteAsValues"
In Sub PasteAsValues I am using the following code to paste as values:
Selection.PasteSpecial Paste:=xlPasteValues
This works perfectly if the user copies cells within Excel and pastes them.
However, if I copy a value from NOTEPAD, and paste it into Excel, I get the following runtime error:
Run-time error '1004':
PasteSpecial method of Range class failed
How can I adjust my code so that it pastes as values no matter where the source is I'm copying from? (e.g. Excel, Notepad, a web browser, etc.).
Matthew
I am hooking into the CTRL + V paste shortcut with the following code and redirecting it to my custom "PasteAsValues" procedure:
Application.OnKey "^v", "PasteAsValues"
In Sub PasteAsValues I am using the following code to paste as values:
Selection.PasteSpecial Paste:=xlPasteValues
This works perfectly if the user copies cells within Excel and pastes them.
However, if I copy a value from NOTEPAD, and paste it into Excel, I get the following runtime error:
Run-time error '1004':
PasteSpecial method of Range class failed
How can I adjust my code so that it pastes as values no matter where the source is I'm copying from? (e.g. Excel, Notepad, a web browser, etc.).
Matthew