我有一个 vsflexgrid 填充这样的数据:
ID - Name - Rate - Gift
100- jack - 2 -
101- Mark - 6 -
102- peter - 10 -
我想为每一行计算多个费率并以此填充礼品列。例如:如果 rate = 0 并且 rate <5 那么 Gift=0
我使用此代码,但仅适用于第一行:根据列费率填充的礼品列
dim i,Numrate , Numgift as integer
For i = 1 To VSF(3).Rows - 1
Numrate = VSF(3).TextMatrix(i, 3)
Numgift = VSF(3).TextMatrix(i, 4)
If Numrate = 0 And Numrate < 5 Then
Numgift = 0
ElseIf Numrate >= 5 And Numrate < 9 Then
Numgift = 1
ElseIf Numrate >= 10 And Numrate < 14 Then
Numgift = 1 = 2
ElseIf Numrate >= 15 And Numrate < 19 Then
Numgift = 1 = 3
ElseIf Numrate >= 20 And Numrate < 24 Then
Numgift = 1 = 4
End If
Next i
结果应该是:
ID - Name - Rate - Gift
100- jack - 2 - 0
101- Mark - 6 - 1
102- peter - 10 - 2