老师好!
为统计表的5个临时列循环行、赋值,非常慢,是不是代码写的有问题?
此主题相关图片如下:截屏图片 (3).jpg
For Each r As Row In Tables("批量选股_table10").Rows ’窗口表循环行
If r("日期") <= Date.Today Then
Dim dr1 As DataRow
dr1 = DataTables("股piao日线").SQLFind("代码 = '999999' and 日期 = '" & r("日期") & "'")
If dr1 IsNot Nothing
r("上证指数") = dr1("涨跌幅")
End If
Dim dr2 As DataRow
dr2 = DataTables("股piao日线").SQLFind("代码 = '399001' and 日期 = '" & r("日期") & "'")
If dr2 IsNot Nothing
r("深圳成指") = dr2("涨跌幅")
End If
Dim dr3 As DataRow
dr3 = DataTables("股piao日线").SQLFind("代码 = '399005' and 日期 = '" & r("日期") & "'")
If dr3 IsNot Nothing
r("中小板指") = dr3("涨跌幅")
End If
Dim dr4 As DataRow
dr4 = DataTables("股piao日线").SQLFind("代码 = '399006' and 日期 = '" & r("日期") & "'")
If dr4 IsNot Nothing
r("创业板指") = dr4("涨跌幅")
End If
Dim dr5 As DataRow
dr5 = DataTables("股piao日线").SQLFind("代码 = '399106' and 日期 = '" & r("日期") & "'")
If dr5 IsNot Nothing
r("深圳综指") = dr5("涨跌幅")
End If
End If
Next
[此贴子已经被作者于2020/11/9 21:17:53编辑过]