将列从一个Excel工作表复制到另一个Excel工作表 [英] Copy column from one Excel sheet to another Excel sheet

查看:148
本文介绍了将列从一个Excel工作表复制到另一个Excel工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将特定的列从一个Excel工作表复制到其他工作簿中的另一个Excel工作表。如何使用宏将一些列复制到不同的Excel工作表?

解决方案

假设有两个工作簿(源和目标)并且您要将源工作簿中的列A复制到目标工作簿中的列A.

  Sub CopyColumnToWorkbook()
Dim sourceColumn As Range,targetColumn As Range

设置sourceColumn =工作簿(Source)。工作表(Sheet1)。列(A)
设置targetColumn =目标)工作表(Sheet1)。列(A)

sourceColumn.Copy目标:= targetColumn
End Sub
/ pre>

很明显,您可以根据需要更改列。


I want to copy particular columns from one Excel sheet to another Excel sheet in a different workbook. How can I use a macro to copy some columns to different Excel sheet?

解决方案

Suppose you have two workbooks (source and target) and you want to copy column A in the source workbook to column A in the target workbook.

Sub CopyColumnToWorkbook()
    Dim sourceColumn As Range, targetColumn As Range

    Set sourceColumn = Workbooks("Source").Worksheets("Sheet1").Columns("A")
    Set targetColumn = Workbooks("Target").Worksheets("Sheet1").Columns("A")

    sourceColumn.Copy Destination:=targetColumn
End Sub

Clearly you can change the columns as you see fit.

这篇关于将列从一个Excel工作表复制到另一个Excel工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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