给你个基本的,不考虑速度。 Public Sub other_way() Dim i_col As Integer, j_col As Integer, last_row As Long, last_col_jg As Integer, last_col_B As Integer, i_copy As Long last_row = Worksheets("结果表").Range("a65536").End(xlUp).Row last_col_jg = Worksheets("结果表").Range("a1").End(xlToRight).Column last_col_B = Worksheets("B").Range("a1").End(xlToRight).Column 'copy name to sheets("B") Worksheets("结果表").Range("a2:a" & Range("a65536").End(xlUp).Row).Copy Worksheets("B").Range("a2") 'copy related column to B For i_col = 1 To last_col_B 'UBound(arr_B) For j_col = 1 To last_col_jg 'UBound(arr_jg) If Worksheets("结果表").Cells(1, j_col) = Worksheets("B").Cells(1, i_col) Then For i_copy = 2 To last_row Worksheets("结果表").Cells(i_copy, j_col).Copy Worksheets("B").Cells(i_copy, i_col) Next i_copy End If Next j_col Next i_col End Sub |