如图,这是一个计算的程序!我想实现的是当时间不连续时,比如7月7号的23点和7月8号的12点,要想使12点对应的数据等于我设定的室内温度数据,比如29℃,而不是跟前面计算过的数据相关联的,就不如上面的2个表格中的数,左边的是不连续时间的数值受上一时刻计算的数值的影响,右边的则是不收影响,重新等于一个数(这里设的是比28.28小2度),想实现右边的这种功能应该如何实现?

解决方案 »

  1.   

    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
                If Abs(Val(Text53.text) - Val(Text102.text)) > 1 And Abs(Val(Text53.text) - Val(Text102.text)) <> 23 Then
                    Do Until Val(Text29.text) - Val(Combo6.text) < 1
                        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 + 100000)
                        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)
                    Loop
                End If
                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 + 100000)
                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)
            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 + 100000)
                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)
            ElseIf Val(Text29.text) - Val(Combo6.text) < -0.5 Then
                Text92.text = 0
                Text93.text = 0
                Text94.text = 25
                    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 + 100000)
                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) + 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 + 100000)
                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)
            End If
            Loop
            n = n + 1
            Text102.text = Text53.text
            Adodc6.Recordset.MoveNext
        Loop
        MsgBox "计算结束,请点击 计算数据读取 来查看结果"
    End Sub