Foxtable(狐表)用户栏目专家坐堂 → [求助]代码统计一行某几个单元格求和的方法?


  共有2359人关注过本帖平板打印复制链接

主题:[求助]代码统计一行某几个单元格求和的方法?

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/11/17 14:32:00 [只看该作者]

这样写比较精确

 

If e.DataCol.name Like "物料组_*" Then
    Dim sum As Double = 0
    For Each dc As DataCol In e.DataTable.DataCols
        If dc.name Like "物料组_*" Then
            sum += e.DataRow(dc.name)
        End If
    Next
    e.DataRow("物料组合计") = sum
Else If e.DataCol.name Like "维修组_*" Then
    Dim sum As Double = 0
    For Each dc As DataCol In e.DataTable.DataCols
        If dc.name Like "维修组_*" Then
            sum += e.DataRow(dc.name)
        End If
    Next
    e.DataRow("维修组合计") = sum
End If


 回到顶部
总数 12 1 2 下一页