简体   繁体   English

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

[英]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). 首先,将CopyDestination一起使用是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.

相关问题 从一张纸到另一张纸复制并粘贴一系列单元格,然后清除原始单元格中的数据 - Copy and paste a range of cells from one sheet to another then clear data from orignal cells Exce:VB命令将一系列单元格从一张纸复制到另一张纸 - Exce: VB command to copy a range of cells from one sheet to another sheet 如何在一张纸到另一张纸中的特定单元格的范围内复制单元格数据? - How do you copy cell data in a range from one sheet to specific cells in another sheet? 我想将单元格的范围从一张纸复制到下一张空白行的另一张纸 - I want to copy a range of cells from one sheet to another sheet in the next blank row 将页眉和范围从一张纸复制到另一张纸 - Copy header and range from one sheet to another 将范围从一张纸复制/粘贴到另一张纸 - Copy/Paste Range from one sheet to another 从一张纸复印范围并插入另一张纸 - Copy range from one sheet and insert into another 将单元格范围从一个工作簿复制到另一个工作簿 - Copy range of cells from one workbook to another Macro Excel可根据单元格匹配将范围单元格从一张纸复制到另一张纸,如果不匹配,则跳过单元格 - Macro Excel to copy range cells from one sheet to another based on cell match and skip cell if no match 将单元格从一张纸复制到另一张纸,对范围内的所有单元格重复 - Copy cell from one sheet to another, repeat for all cells within range
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM