以文本方式查看主题
-
Foxtable(狐表)
(http://foxtable.com/bbs/index.asp)
--
专家坐堂
(http://foxtable.com/bbs/list.asp?boardid=2)
----
[求助]列自动求和
(http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=92304)
-- 作者:allwin100
-- 发布时间:2016/10/31 15:19:00
-- [求助]列自动求和
此主题相关图片如下:无标题.jpg
上表,我想自动把本月内相应天数的列数据求和至月累积内,并根据今天日历日期,求出日平均
写了一个代码
Dim i As Integer
i = 0
For i = 1 To Days
Dim Ylj As String = "油" & i
For Each dr As DataRow In DataTables("数据").DataRows
dr("油某日") = dr("油") - dr(Ylj)
dr("油月累") = dr("油月累") + dr("油某日")
Next
Next
求老师讲讲怎么写,谢谢
-- 作者:有点蓝
-- 发布时间:2016/10/31 16:14:00
--
Dim i As Integer
i = 0
For Each dr As DataRow In DataTables("数据").DataRows
Dim sum As Double
For i = 1 To Days
Dim Ylj As String = "油" & i
sum += dr(Ylj)
Next
dr("油月累") = sum
dr("日凭据") = sum / Days
Next