请教VB中代码编写!
Private Sub Command5_Click()
Do While Not Adodc6.Recordset.EOF
j = 2 + 60 * n
Do Until i = j
If Val(Text29.text) - Val(Combo6.text) > 3 Then
Text92.text = Val(Text80.text)
Text93.text = Val(Text84.text) * Val(Text92.text) ^ 2 + Val(Text85.text) * Val(Text92.text) + Val(Text96.text)
Text94.text = Val(Text86.text) * Val(Text92.text) + Val(Text87.text)
newsheet.Cells(i, 1).Value = Text97.text
newsheet.Cells(i, 2).Value = Text53.text
newsheet.Cells(i, 3).Value = Text28.text
newsheet.Cells(i, 4).Value = Text29.text
newsheet.Cells(i, 5).Value = Text26.text
newsheet.Cells(i, 6).Value = Text93.text
newsheet.Cells(i, 7).Value = Text94.text
newsheet.Cells(i, 8).Value = Text98.text
newsheet.Cells(i, 9).Value = Text99.text
newsheet.Cells(i, 10).Value = Text100.text
newsheet.Cells(i, 11).Value = Fix(Text92.text + 0.5)
Text29.text = Val(Text29.text) - (Val(Text93.text) - Val(Text26.text)) * 60 / (Text1(0).text * Text1(1).text * Text1(2).text * 1.2 * 1000 + 200000)
Text98.text = Val(Text93.text) / 60000 + Val(Text98.text)
Text99.text = Val(Text94.text) / 60000 + Val(Text99.text)
Text100.text = Val(Text98.text) / Val(Text99.text)
i = i + 1
ElseIf Val(Text29.text) - Val(Combo6.text) < 0 And Val(Text29.text) - Val(Combo6.text) >= -0.5 Then
Text92.text = Val(Text78.text)
Text93.text = Val(Text84.text) * Val(Text92.text) ^ 2 + Val(Text85.text) * Val(Text92.text) + Val(Text96.text)
Text94.text = Val(Text86.text) * Val(Text92.text) + Val(Text87.text)
newsheet.Cells(i, 1).Value = Text97.text
newsheet.Cells(i, 2).Value = Text53.text
newsheet.Cells(i, 3).Value = Text28.text
newsheet.Cells(i, 4).Value = Text29.text
newsheet.Cells(i, 5).Value = Text26.text
newsheet.Cells(i, 6).Value = Text93.text
newsheet.Cells(i, 7).Value = Text94.text
newsheet.Cells(i, 8).Value = Text98.text
newsheet.Cells(i, 9).Value = Text99.text
newsheet.Cells(i, 10).Value = Text100.text
newsheet.Cells(i, 11).Value = Fix(Text92.text + 0.5)
Text29.text = Val(Text29.text) - (Val(Text93.text) - Val(Text26.text)) * 60 / (Text1(0).text * Text1(1).text * Text1(2).text * 1.2 * 1000 + 200000)
Text98.text = Val(Text93.text) / 60000 + Val(Text98.text)
Text99.text = Val(Text94.text) / 60000 + Val(Text99.text)
Text100.text = Val(Text98.text) / Val(Text99.text)
i = i + 1
ElseIf Val(Text29.text) - Val(Combo6.text) < -0.5 Then
Text92.text = 0
Text93.text = 0
Text94.text = Val(Text83.text)
newsheet.Cells(i, 1).Value = Text97.text
newsheet.Cells(i, 2).Value = Text53.text
newsheet.Cells(i, 3).Value = Text28.text
newsheet.Cells(i, 4).Value = Text29.text
newsheet.Cells(i, 5).Value = Text26.text
newsheet.Cells(i, 6).Value = Text93.text
newsheet.Cells(i, 7).Value = Text94.text
newsheet.Cells(i, 8).Value = Text98.text
newsheet.Cells(i, 9).Value = Text99.text
newsheet.Cells(i, 10).Value = Text100.text
newsheet.Cells(i, 11).Value = Fix(Text92.text + 0.5)
Text29.text = Val(Text29.text) - (Val(Text93.text) - Val(Text26.text)) * 60 / (Text1(0).text * Text1(1).text * Text1(2).text * 1.2 * 1000 + 200000)
Text98.text = Val(Text93.text) / 60000 + Val(Text98.text)
Text99.text = Val(Text94.text) / 60000 + Val(Text99.text)
Text100.text = Val(Text98.text) / Val(Text99.text)
i = i + 1
Text92.text = Val(Text81.text)
Else
Text92.text = Val(Text81.text)
Text92.text = Val(Text92.text) + 3 * (Val(Text29.text) - Val(Combo6.text))
Text93.text = Val(Text84.text) * Val(Text92.text) ^ 2 + Val(Text85.text) * Val(Text92.text) + Val(Text96.text)
Text94.text = Val(Text86.text) * Val(Text92.text) + Val(Text87.text)
newsheet.Cells(i, 1).Value = Text97.text
newsheet.Cells(i, 2).Value = Text53.text
newsheet.Cells(i, 3).Value = Text28.text
newsheet.Cells(i, 4).Value = Text29.text
newsheet.Cells(i, 5).Value = Text26.text
newsheet.Cells(i, 6).Value = Text93.text
newsheet.Cells(i, 7).Value = Text94.text
newsheet.Cells(i, 8).Value = Text98.text
newsheet.Cells(i, 9).Value = Text99.text
newsheet.Cells(i, 10).Value = Text100.text
newsheet.Cells(i, 11).Value = Fix(Text92.text + 0.5)
Text29.text = Val(Text29.text) - (Val(Text93.text) - Val(Text26.text)) * 60 / (Text1(0).text * Text1(1).text * Text1(2).text * 1.2 * 1000 + 200000)
Text98.text = Val(Text93.text) / 60000 + Val(Text98.text)
Text99.text = Val(Text94.text) / 60000 + Val(Text99.text)
Text100.text = Val(Text98.text) / Val(Text99.text)
i = i + 1
End If
Loop
n = n + 1
Text102.text = Text53.text
Adodc6.Recordset.MoveNext
Loop
MsgBox "计算结束,请点击 计算数据读取 来查看结果"
End Sub
If Abs(Val(Text53.text) - Val(Text102.text)) > 1 And Abs(Val(Text53.text) - Val(Text102.text)) <> 23 Then
Text29.text = Val(Text101.text)
End If
这两个代码联合作用!
我想实现的是每次循环开始的cell(i,11)的值都是一个定值,即text92.text,并且每次cell(i,11)=0后的cell(i,11)的值也是定值text92.text。当Text29.text 重新等于 Val(Text101.text)的时候,也实现同样的功能,即cell(i,11)的值等于定值text92.text!大侠们,能实现吗,如何实现啊??