繁体   English   中英

将单元格范围从一张纸复制到另一张纸

[英]Copy range of cells from one sheet to another

我想将具有不同条目数的列(通过使用.End(xlDown))复制到另一张向下的工作表的C列中。

With Sheets("General Text")
    Range(Range("A2"), Range("A2").End(xlDown)).Copy 
    Destination:=Sheets("Compiler").Range(Range("C2"), Range("C2").End(xlDown))
End With

我不确定这是否是最简单的方法,但是我尝试了几次迭代,但总是出错

首先,将CopyDestination一起使用是1行命令(不是2行)。

其次,您需要通过addind a来在With Sheets("General Text")语句中完全限定Range . 作为前缀。

请尝试以下代码:

With Sheets("General Text")
    .Range(.Range("A2"), .Range("A2").End(xlDown)).Copy Destination:=Sheets("Compiler").Range("C2")
End With

暂无
暂无

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

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