For i As Integer = 0 To Tables("表A").rows.count -1 Tables("表A").Rows(i)("辅助") = i+1 Next For Each dr As DataRow In DataTables("表A").DataRows If dr("辅助") > 9 Then dr("移动平均值") = DataTables("表A").Compute("Avg(收盘)","辅助 >= " & dr("辅助")-9 & " And 辅助 <= " & dr("辅助")) End If Next