在一列中将多个列从一个工作表复制到另一个工作表时,我需要帮助。以下是一个例子。 谢谢!
Adam Sammy Roy
111 444 777
222 555 888
333 666 999
Adam
111
222
333
Sammy
444
555
666
Roy
777
888
999
答案 0 :(得分:0)
我猜你可以用这些代码来做。
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