开发者

Copy column from one Excel sheet to another Excel sheet [closed]

开发者 https://www.devze.com 2023-03-13 10:36 出处:网络
开发者_JAVA百科 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form.
开发者_JAVA百科 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消