If (k > 1) Then
Dim n3 As Integer, sum3 As Integer
Text9.Text = Left(Data, k - 1)
arr3(count3) = Val(Text9.Text) 'Abs(Val(Text9.Text) - WZero) * ktw
For n3 = 0 To count3 Step 1
sum3 = sum3 + arr3(n3)
Next
count3 = count3 + 1
Weight = Abs((sum3 / count3) - WZero) * ktw
NTGraph1.PlotY Weight, 0
Text1.Text = Str(Weight)
Select Case (Val(Combo1.Text))
Case (1)
MDI.Weight1 = Weight
Case (2)
MDI.Weight2 = Weight
Case (3)
MDI.Weight3 = Weight
Case (4)
MDI.Weight4 = Weight
End Select
End If
Asked
Active
Viewed 39 times
1

VBasic2008
- 44,888
- 5
- 17
- 28

Vũ Trung Dũng
- 11
- 2
-
error cause: sum3 = sum3 + arr3(n3) – Vũ Trung Dũng Jul 10 '22 at 11:18
-
This looks meaning that `sum3` exceeds the limit of an `Integer`. Please, try declaring the involved variables `As Long`. In VBA doing that will not bother the memory handling, anyhow... – FaneDuru Jul 10 '22 at 11:25