Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
..............
Dim g As New GroupTableBuilder("分组统计", DataTables("总览"),Filter)
If e.Form.Controls("CheckBox1").Checked Then g.Groups.AddDef("造林年度")
If e.Form.Controls("CheckBox2").Checked Then g.Groups.AddDef("乡名")
If e.Form.Controls("CheckBox3").Checked Then g.Groups.AddDef("村名")
If e.Form.Controls("CheckBox4").Checked Then g.Groups.AddDef("造林树种_主要树种","主要树种")'添加村名列用于分组
g.Totals.AddDef("小班号",AggregateEnum.Count,"小班个数")
g.Totals.AddDef("设计面积","面积合计") '添加数量列用于统计
g.VerticalTotal = True '自动垂直汇总
g.Build()
MainTable = Tables("分组统计")
Tables("分组统计").Sort = "面积合计 DESC" '降序排列
,移动“合计”
If cmc.Value IsNot Nothing or e.Form.Controls("CheckBox3").Checked Then
移动“合计”(如图)
End if
.............
If cmc.Value IsNot Nothing or e.Form.Controls("CheckBox3").Checked Then
Tables("分组统计").Rows(0)("乡名") =Nothing
Tables("分组统计").Rows(0)("村名") ="合计"
End if
If cmc.Value IsNot Nothing or e.Form.Controls("CheckBox3").Checked Then
Tables("分组统计").Rows(0)("乡名") =Nothing
Tables("分组统计").Rows(0)("村名") ="合计"
End if
非常感谢!从源头上移动比原来用VBA改变报表“合计”位置,效率提高十多倍。
省去了下列耗时的VBA代码
...............
Dim App As New MSExcel.Application
Dim Wb As MSExcel.Workbook = App.WorkBooks.Open("D:\My Documents\退耕报表\" & cma.Value & cmb.Value & cmc.Value & cmd.Value & cme.Value & Name & ".xls")
Dim Wd As MSExcel.Window = Wb.Windows(1) '表示当前工作簿窗口
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Wd.DisplayZeros = False '不显示0值
' App.Visible = True '可见
If name = "结果分析" Then
Wb.Sheets(1).range("A5").Value = "合计"
End If
If name = "林种统计" Then
Wb.Sheets(1).range("A5").Value = "合计"
End If
If name = "面积统计" Then
Wb.Sheets(1).range("A5").Value = "合计"
End If
If name = "秋季验收" Then
Wb.Sheets(1).range("A6").Value = "合计"
End If
If name = "补助测算" Then
Wb.Sheets(1).range("A7").Value = "合计"
End If
If name = "坡度统计" Then
Wb.Sheets(1).range("A5").Value = "合计"
End If
If name = "权属统计" Then
Wb.Sheets(1).range("A5").Value = "合计"
End If
If name = "设计汇总" Then
Wb.Sheets(1).range("A6").Value = "合计"
End If
If name = "设计统计" Then
Wb.Sheets(1).range("A7").Value = "合计"
End If
If name = "投资测报" Then
Wb.Sheets(1).range("A7").Value = "合计"
End If
If name = "预算汇总" Then
Wb.Sheets(1).range("A7").Value = "合计"
End If
If name = "植被统计" Then
Wb.Sheets(1).range("A5").Value = "合计"
End If
If name = "验收汇总" Then
Wb.Sheets(1).range("A6").Value = "合计"
End If
If name = "二期补助" Then
Wb.Sheets(1).range("A7").Value = "合计"
End If
Wb.Save
App.Quit
............