For Each r As Row In Tables("表A").Rows For Each c As Col In r.Table.Cols If r.IsNull(c.name) = False Then Dim n As Integer = -1 For i As Integer = c.Index-1 To 0 Step -1 If i = 0 AndAlso r.Isnull(i) Then n = 0 ElseIf r.IsNull(i) = False Then n = i+1 Exit For End If Next If n > -1 Then Dim fdr As DataRow = DataTables("表B").find("行 = '" & r.index+1 & "' and 列 = '" & c.name & "'") If fdr Is Nothing Then fdr = DataTables("表B").addnew fdr("行") = r.Index+1 End If fdr("列") = r.Table.Cols(n).name r(n) = r(c.name) r(c.name) = Nothing End If End If Next Next
|