View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas[_2_] Gary Keramidas[_2_] is offline
external usenet poster
 
Posts: 364
Default Problem adding the values of 2 TextBoxes

try cval(TextBox13.value) + cval(TextBox23.value)

--


Gary K



"Patrick C. Simonds" wrote in message
...
Can anyone tell me why these do not add together?

TextBox1 = TextBox13.Value + TextBox23.Value

Lets say the value of TextBox13 is 53 and the value of TextBox23 is 10.
Instead of returning 63 I get 5310.



Below is the code that generates the value of TextBox13

TextBox13.Value = (TimeValue(TextBox12.Value) -
TimeValue(TextBox11.Value)) * 24
TextBox13.Value = Format(TextBox13.Value, "0.0000")



TextBox12 value is entered by the user as a time without the : such as
1843 for 6:43 pm and then converted to the correct format by the code
below


Private Sub TextBox12_AfterUpdate()

TextBox12.Value = Format(Application.Text(Replace(TextBox12.Value, ":",
""), "00\:00"), "hh:mm")

End Sub