VB Code for Excel  From CUT  Paste VALUES only

oaktrees
oaktrees used Ask the Experts™
on
VB Code for Excel

From CUT

Paste VALUES only

Hello Kind Expert!  Need help with VB code that I can apply a keyboard shortcut to so that from a

Cut (Ctrl+x)

the Paste (Ctrl+Shift+Z) pastes values only.

Sincerely,

OT
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Roy CoxGroup Finance Manager

Commented:
Do you mean VBA?

Option Explicit

Sub PasteValues()

'
' Keyboard Shortcut: Ctrl+Shift+X
'
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
        ''///clear the clipboard
        Application.CutCopyMode = False
        
        MsgBox "Range " & Selection.Address & " pasted as values", vbInformation, "Done"
End Sub

Open in new window

Group Finance Manager
Commented:
Alternatively you needn't use Paste

Sub PasteValues()

'
' Keyboard Shortcut: Ctrl+Shift+Z
'

    With Selection
        .Copy
        .Value = .Value
    End With

    MsgBox "Range " & Selection.Address & " pasted as values", vbInformation, "Done"
End Sub

Open in new window


I've just noticed that you wanted to use Z s the shortcut, just amend y first code like this one

Author

Commented:
THANKS!!! :)))
Roy CoxGroup Finance Manager

Commented:
Pleased to help

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial