如果两张表之间的数据经常复制,就将有关列的列名设为完全一样。用下面的代码,不用关心具体列名,代码用在另外的表,只要改表名就行了:
For Each r As Row In Tables("表A").Rows Dim r1 As Row = Tables("表B").AddNew() For Each c As Col In Tables("表A").Cols For Each c1 As Col In Tables("表B").Cols If c.Name = c1.Name Then r1(c1.Name) = r(c.Name) End If Next NextNext