Hallo Leute,
ich habe ein Prpblem mit einem kleinen VBA-skript. Ich habe einen stufenförmigen Verlauf eines Messwertes und möchte bei jeder Stufe inerhalb einer If-anweisung eine Zählvariable hochzählen:
Sub Main
Dim peakcontrolin As Double
Dim peakcontrolout As Double
Dim zaehler As Integer
EA_DAQ.CurrentReading("xPEAK1",peakcontrolin,0) 'Momentanwert des Stufenverlaufs
If peakcontrolin > peakcontrolout Then
EA_Panel.GetCell(1,"TABLE_11",1,5,zaehler)
zaehler=zaehler+ 1
EA_Panel.SetCell 1,"TABLE_11",1,5,zaehler,TYPE_CONTENT
peakcontrolout=peakcontrolin
End If
EA_Panel.SetCell 1,"TABLE_11",1,1,peakcontrolin,TYPE_CONTENT
EA_Panel.SetCell 1,"TABLE_11",1,2,peakcontrolout,TYPE_CONTENT
End Sub
Leider zählt die Zählvariable unkontrolliert hoch, obwohl peakcontrolin und peakcontrolout exakt gleich sind.
Bin leider ein Anfängerm, aber vielleicht hat jemand eine Idee, woran dies liegen könnte.....
Vielen Dank im voraus.
AT
|