Set paste values as default paste when using Ctrl + V with VBA code

Set paste values as default paste when using Ctrl + V with VBA code


When you paste the data as values only, you need to click the little square at the corner of your selection and choose Values option each time after pasting the data. The following VBA code can help you to change the default paste to paste values.
1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste the following code in the Module Window.
VBA code: Set paste values as default paste when using Ctrl + V
1
2
3
Sub PasteasValue()
Selection.PasteSpecial Paste:=xlPasteValues
End Sub
3. Then save and close the code, and press Alt + F8 keys to open the Macro dialog box.
4. In the Macro dialog, choose the used macro name PasteasValue and then click Options button, see screenshot:
doc-paste-values-default-1
5. Then in the Macro Options dialog box, under the Shortcut key section, please enter v , see screenshot:
doc-paste-values-default-2
6. And then click OK to close the Macro Options dialog, and go on closing the Macro dialog.
And now, when you paste the data with Ctrl + V, the data will be pasted as values by default.

Comments

Popular posts from this blog

Add GitHub Repository to DBeaver CE Secured with SSH Protocol

Keyboard Shortcut to "Toggle Line Comments" in DBeaver

DBeaver Shortcuts