S
scantor145
Visual Basic 6.3
Excel 2003
I created a form that has some text boxes in which a user inputs
numbers.
Sounds simple to me.
The name of the form is frmEasyLyteQC
The name of one textbox is txtMinNa
The name of second textbox is txtMaxNa
User opens the form and inputs 135 in first box and 145 in second box,
then clicks OK.
I declared the following variables before showing the form:
Code:
--------------------
Public NaMin As Variant
Public NaMax As Variant
Public MedianNa As Variant
Sub QCTrack()
frmEasyLyteQC.txtAnalDate.SetFocus
frmEasyLyteQC.Show
End Sub
--------------------
Here is the section of the program where those values are seen:
Code:
--------------------
NaMin = frmEasyLyteQC.txtMinNa.Value
NaMax = frmEasyLyteQC.txtMaxNa.Value
MedianNa = (NaMin + NaMax)/2
--------------------
When I step through the program and place cursor over NaMin the value
displayed is "135" and the value for NaMax is "145"
When I cursor over to MedianNa the value is "67572.5"
I've written many other programs before with similar code using
different variables, but can't figure out why the calculation is
strange. Obviously Median Na sholud be 140.
Any clues?
Excel 2003
I created a form that has some text boxes in which a user inputs
numbers.
Sounds simple to me.
The name of the form is frmEasyLyteQC
The name of one textbox is txtMinNa
The name of second textbox is txtMaxNa
User opens the form and inputs 135 in first box and 145 in second box,
then clicks OK.
I declared the following variables before showing the form:
Code:
--------------------
Public NaMin As Variant
Public NaMax As Variant
Public MedianNa As Variant
Sub QCTrack()
frmEasyLyteQC.txtAnalDate.SetFocus
frmEasyLyteQC.Show
End Sub
--------------------
Here is the section of the program where those values are seen:
Code:
--------------------
NaMin = frmEasyLyteQC.txtMinNa.Value
NaMax = frmEasyLyteQC.txtMaxNa.Value
MedianNa = (NaMin + NaMax)/2
--------------------
When I step through the program and place cursor over NaMin the value
displayed is "135" and the value for NaMax is "145"
When I cursor over to MedianNa the value is "67572.5"
I've written many other programs before with similar code using
different variables, but can't figure out why the calculation is
strange. Obviously Median Na sholud be 140.
Any clues?