以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  哪位帮我改成简洁的代码  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=59525)

--  作者:zhangchi96
--  发布时间:2014/11/5 21:49:00
--  哪位帮我改成简洁的代码

Dim t As Table = Tables("岗位聘用统计")
Dim r1, r2 ,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12 As Row
Dim i As Integer = 0
r1 = t.Rows(i)
r2 = t.Rows( i + 1 )
r3 = t.Rows( i + 2 )
r4 = t.Rows( i + 3 )
r5 = t.Rows( i + 4 )
r6 = t.Rows( i + 5 )
r7 = t.Rows( i + 6 )
r8 = t.Rows( i + 7 )
r9 = t.Rows( i + 8 )
r10 = t.Rows( i + 9 )
r11 = t.Rows( i + 10 )
r12 = t.Rows( i + 11 )

。。。。。。

r1("变更_年月") = "201411"
r2("变更_年月") = val(r1("变更_年月")) - 1
r3("变更_年月") = val(r2("变更_年月")) - 1
r4("变更_年月") = val(r3("变更_年月")) - 1
r5("变更_年月") = val(r4("变更_年月")) - 1
r6("变更_年月") = val(r5("变更_年月")) - 1
r7("变更_年月") = val(r6("变更_年月")) - 1
r8("变更_年月") = val(r7("变更_年月")) - 1
r9("变更_年月") = val(r8("变更_年月")) - 1
r10("变更_年月") = val(r9("变更_年月")) - 1
r11("变更_年月") = val(r10("变更_年月")) - 1
r12("变更_年月") = val(r11("变更_年月")) - 1

。。。。。。

 

改写后在  ("变更_年月") = 201400后终止,谢谢专家!



--  作者:有点甜
--  发布时间:2014/11/5 21:52:00
--  
Dim t As Table = Tables("岗位聘用统计")
Dim v As Integer = 201411
For i As Integer = 0 To 11
    t.Rows(i)("变更_年月") = v
    v = v - 1
Next