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.
精彩评论