这里是表格中的两个列表,我希望列表包含列表1的数据和列表2中的额外数据。请建议代码。感谢
清单1(a,b,c栏)
A B C name class marks a 1 12 b 2 13 c 5 14 d 4 15
清单2(列d e f)
D E F name class marks z 2 4 d 6 2 c 8 6 x 9 8
结果(保持列表1和列g中的额外列表g h i)
G H I name class marks a 1 12 b 2 13 c 5 14 d 4 15 z 2 4 x 9 8
答案 0 :(得分:0)
这是怎么回事:
com.stripe:stripe-android
编辑:经过讨论(见下面的评论),请使用以下代码:
Sub test()
Dim lastRow1 As Integer, lastRow2 As Integer, newLastRow As Integer, lastCol As Integer, i As Integer
Dim headers() As Variant
ReDim headers(2)
headers() = Array("Name", "Class", "Marks")
lastRow1 = Cells(1, 1).End(xlDown).Row
lastRow2 = Cells(1, 4).End(xlDown).Row
Dim rng1 As Range, rng2 As Range
Set rng1 = Range(Cells(2, 1), Cells(lastRow1, 3))
Set rng2 = Range(Cells(2, 4), Cells(lastRow2, 6))
Range(Cells(1, 7), Cells(1, 9)) = headers()
newLastRow = 2
rng1.Copy Range(Cells(newLastRow, 7), Cells(newLastRow, 7))
newLastRow = Cells(2, 7).End(xlDown).Row + 1
rng2.Copy Range(Cells(newLastRow, 7), Cells(newLastRow, 7))
End Sub