简体   繁体   中英

Excel VBA - Paste from clipboard

I'm trying to build a macro that looks like this:

Sub CopyAsValues()
Selection.PasteSpecial xlPasteValues
End Sub

It seems to me that Excel requires from me to add a copy line, eg:

Range("C1:C5").Copy"

But I don't want to. I want to manually copy from cells, and then use the macro to paste as values. How can I do that?

You do not need macro for this, comfortable way to paste only values, I guess, will be using quick access toolbar as in picture below

Excel Option ~~> Customize ~~> Choose commands from [All Commands] ~~> Select "Paste Values" command and add to toolbar

在此输入图像描述

so you will receive button in top of the excel window with required option

在此输入图像描述

then you can copy and paste only values using this button

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM