Counter for Online Value

Counter for Online Value

Hi Zenon Support Team,
I can scaling non-linear value with macro but i need to count scaled value on every change.
It is tab-position of transformer.. I scale the value to see position of transformer and i want to count it on every changing. and it should not count, when the position dont change. but it doesnt work.
Have I a code problem or something else? What can i do solve the problem?
VBA Code:
'Example:
Public Function AdjustHardwareValue_a(obVar As Variable, vValue As Variant) As Double
Dim x As Integer
x = AdjustHardwareValue_a
Select Case vValue
Case 0 To 9999
AdjustHardwareValue_a = 0
Case 10000 To 19999
AdjustHardwareValue_a = 1
Case 20000 To 29999
AdjustHardwareValue_a = 2
Case 30000 To 39999
AdjustHardwareValue_a = 3
............
Case Else
AdjustHardwareValue_a = 15
End Select
If AdjustHardwareValue_a <> x Then
thisProject.Variables.Item("Trafo_Counter").Value = thisProject.Variables.Item("Trafo_Counter").Value + 1
End If
End Function


This is a migrated post! Originally posted on 24.07.2014 by user fatih.oz. Please be aware that information can be outdated.