For Each v As String In DataTables("表A").GetValues("批次") For Each dr As DataRow In DataTables("汇总").DataRows If dr.IsNull("编号") Then dr("批次_" & v) = Nothing Else Dim pr As DataRow = DataTables("表A").Find("编号 = '" & dr("编号") & "' And 批次 = '"& v &"' and 考勤类别 = '缺勤'") If pr IsNot Nothing Then dr("批次_" & v) = pr("缺勤类别") End If End If Next Next