简体   繁体   English

Excel VBA - 从剪贴板粘贴

[英]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: 在我看来Excel要求我添加一个副本行,例如:

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 Excel选项~~>自定义~~>从[所有命令]中选择命令~~>选择“粘贴值”命令并添加到工具栏

在此输入图像描述

so you will receive button in top of the excel window with required option 因此,您将在excel窗口顶部收到带有所需选项的按钮

在此输入图像描述

then you can copy and paste only values using this button 然后,您可以使用此按钮仅复制和粘贴值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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