[英]Copy range of cells from one sheet to another
I want to copy a column with a varying number of entries (by using .End(xlDown)) into column C of another sheet going downwards. 我想将具有不同条目数的列(通过使用.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
I'm not sure if this is the easiest method, but I've tried a few iterations and it always errors 我不确定这是否是最简单的方法,但是我尝试了几次迭代,但总是出错
First, using Copy
with Destination
is a 1-line command (not 2). 首先,将
Copy
与Destination
一起使用是1行命令(不是2行)。
Second, you need to fully qualify your Range
inside the With Sheets("General Text")
statement, by addind a .
其次,您需要通过addind a来在
With Sheets("General Text")
语句中完全限定Range
.
as a prefix. 作为前缀。
Try the code below: 请尝试以下代码:
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.