答:设含有数据的表名为:Sheet2,被填的空白表名为:Sheet1
宏代码:
Sub Demo()
Dim cell As Range
Dim LastRow As Long
With Sheets("Sheet2")
LastRow = .Cells(Rows.Count, 1).End(xlUp).Row
End With
With CreateObject("scripting.dictionary")
For Each cell In Sheets("Sheet2").Range("A1:AB1")
If Not .exists(cell.Value) Then
Set .Item(cell.Value) = cell.Offset(1, 0).Resize(LastRow - 1, 1)
End If
Next
For Each cell In Sheets("Sheet1").Range("A1:AB1")
If .exists(cell.Value) Then
.Item(cell.Value).Copy cell.Offset(1, 0)
End If
Next
End With
MsgBox "ok"
End Sub