![](/img/trans.png)
[英]VBA: Copy multiple columns from a Sheet into one column from another Sheet
[英]excel vba copy multiple columns to another sheet to one column
我猜你可以用这些代码做到这一点。
Sub one_column()
Dim numCol As Integer
numCol = Sheet1.Cells(1, Columns.Count).End(xlToLeft).Column
Dim i As Integer
Dim lastRow As Integer
For i = 1 To numCol
lastRow = Sheet1.Cells(Rows.Count, i).End(xlUp).Row
Sheet1.Range(Sheet1.Cells(1, i), Sheet1.Cells(lastRow, i)).Copy
firstBlank = Sheet2.Cells(Rows.Count, 1).End(3).Row
If firstBlank = 1 Then
Sheet2.Cells(firstBlank, 1).PasteSpecial
Else
Sheet2.Cells(firstBlank + 1, 1).PasteSpecial
End If
Next
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.