I commented the mistake or the wrong with this code . it is about the variable sum and avg they do not work for some reason please somebody tell me what is wrong with this code
()Private Sub Command1_Click
Dim sum As Double, avg As Double
If Command1.Caption = "New Data Set" Then
vCount = InputBox("how many values do you want to enter")
If Not IsNumeric(vCount) Then
MsgBox "Please enter a numeric data"
Exit Sub
End If
For i = 1 To vCount
Load Label1(i)
Load Text1(i)
Label1(i).Top = Label1(i - 1).Top + 1.25 * Label1(i).Height
Text1(i).Top = Text1(i - 1).Top + 1.25 * Text1(i).Height
Label1(i).Visible = True
Text1(i).Visible = True
Label1(i).Caption = "Value# " & i
Next
Me.Height = Text1(vCount).Top + 2.5 * Text1(vCount).Height
Command1.Caption = "Calculate Data now"
Else
For i = 1 To vCount 'the variable vCount is not passed to this statement?
If IsNumeric(Text1(i).Text) Then
sum = sum + Text1(i)
End If
Next
avg = sum / vCount ' the variable vCount is not passed to this statement?
MsgBox "the average is & avg"
For i = 1 To vCount
Unload Label1(i)
Unload Text1(i)
Next
Me.Height = 2000
Command1.Caption = "New Data Set"
End If
End Sub