cells().paste VS cells.pastespecial? [英] cells().paste VS cells.pastespecial?

查看:203
本文介绍了cells().paste VS cells.pastespecial?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的代码如何工作:

.Range("D4:F4").copy
.cells(1,1).PasteSpecial  

以下内容不起作用:

.Range("D4:F4").copy
.cells(1,1).Paste  

我意识到正确的语法是

.Range("D4:F4").copy Destination:=

推荐答案

答案很简单.Paste不是Cells对象的属性,而是Worksheet对象的属性

The answer is very simple .Paste is not a property of the Cells object but of the Worksheet Object

如果在Cells之后键入.,则Intellisense将确认这一事实:)

If you type . after the Cells, Intellisense will confirm that fact :)

有多种复制数据的方法.

There are various ways to copy data across.

如果您只想复制值而不是格式,那么这是最好的方法

If you want to only copy values across and not the formatting then this is the best way

rng1.Value = rng2.Value

如果要保留格式,则可以使用

If you want to carry the formatting then either you can use

Rng1.copy Rng2 

Rng1.Copy
rng2.pastespecial

这篇关于cells().paste VS cells.pastespecial?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆