Dim colsName() AS String = {"部门", "姓名", "统计_出勤", "统计_事假"} With DataTables("出勤统计表_table1") For Each dr As DataRow In .DataRows Dim cq As Integer = 0 Dim sj As Integer = 0 For Each dc As DataCol In .DataCols If colsName.Contains(dc.Name) = False Then Select case dr(dc.Name) case 1 cq = cq + 1 case 2 sj = sj + 1 End Select End If Next dr("统计_出勤") = cq dr("统计_事假") = sj Next End With