If MainTable.Name = "汇总" Then DataTables("汇总").DataRows.Clear() dim f As New Filler f.SourceTable = DataTables("产量") '指定数据来源 f.SourceCols = "型号,规格" '指定数据来源列 f.DataTable = DataTables("汇总") '指定数据接收表 f.DataCols = "型号,规格" ' 指定数据接收列 f.Fill() '填充数据 For Each dc As DataCol In DataTables("汇总").DataCols If dc.Name.EndsWith("月") Then For Each dr As DataRow In DataTables("汇总").DataRows dr(dc.name) = DataTables("产量").Compute("Sum(产量)","月 ='" & dc.Name & "' And 型号= '" & dr("型号") & "'And 规格= '" & dr("规格") & "'") Next End If Next End If