Sub copyif()
Dim carr()
Dim R1, C1, R2
C1 = Sheet1.UsedRange.Columns.Count
R1 = Sheet1.UsedRange.Rows.Count
R2 = Sheet2.UsedRange.Rows.Count
carr() = Array(6, 5, 2, 3, 7, 1, 4)
For i = 1 To R1
For j = 1 To C1
Sheet2.Cells(R2 + i, j) = Sheet1.Cells(i + 1, carr(j - 1))
Next
Next
End Sub
把Sheet1与Sheet2改为你的A表与B表名搜租,把Array(6,5,2,3,7,1,4)改为你的A表内1至键激结尾稿漏袜列的对应于B表中第几列列号。修改后运行就可以了。
自己研究下vlookup函数的用法。
用vlookup就可以了