Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default Add the values of TextBoxes

I am attempting to add these TextBox Values and place the results into
TextBox503 but am having no luck. It will place the value of TextBox1 into
TextBox503 but will not add the values in the other TextBoxes.



Private Sub TextBox1_Change()

TextBox503.Value = CDbl("0" & TextBox1.Value) + CDbl("0" & TextBox2.Value) +
CDbl("0" & TextBox3.Value)
TextBox503.Text = Format(TextBox1.Text, "0.0000")

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Add the values of TextBoxes

It does that because you used TextBox1 as the argument for the Format
function call instead of TextBox503. This is what you want...

TextBox503.Text = Format(TextBox503.Text, "0.0000")

--
Rick (MVP - Excel)


"Patrick C. Simonds" wrote in message
...
I am attempting to add these TextBox Values and place the results into
TextBox503 but am having no luck. It will place the value of TextBox1 into
TextBox503 but will not add the values in the other TextBoxes.



Private Sub TextBox1_Change()

TextBox503.Value = CDbl("0" & TextBox1.Value) + CDbl("0" & TextBox2.Value)
+ CDbl("0" & TextBox3.Value)
TextBox503.Text = Format(TextBox1.Text, "0.0000")

End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 449
Default Add the values of TextBoxes

Apologies for disagreeing, I'd do this:

Private Sub TextBox1_Change()
Call Sum503
End Sub

Private Sub TextBox2_Change()
Call Sum503
End Sub

Private Sub TextBox3_Change()
Call Sum503
End Sub

Private Sub Sum503()
Dim DD As Double
DD = Val(TextBox1.Value) + Val(TextBox2.Value) + Val(TextBox3.Value)
TextBox503.Text = Format(DD, "0.0000")
End Sub

Best wishes Harald

"Rick Rothstein" wrote in message
...
It does that because you used TextBox1 as the argument for the Format
function call instead of TextBox503. This is what you want...

TextBox503.Text = Format(TextBox503.Text, "0.0000")

--
Rick (MVP - Excel)


"Patrick C. Simonds" wrote in message
...
I am attempting to add these TextBox Values and place the results into
TextBox503 but am having no luck. It will place the value of TextBox1 into
TextBox503 but will not add the values in the other TextBoxes.



Private Sub TextBox1_Change()

TextBox503.Value = CDbl("0" & TextBox1.Value) + CDbl("0" &
TextBox2.Value) + CDbl("0" & TextBox3.Value)
TextBox503.Text = Format(TextBox1.Text, "0.0000")

End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validating values in textboxes don H. Lee Excel Programming 1 December 10th 08 07:03 PM
Adding values in textboxes... Tom Ogilvy Excel Programming 0 July 27th 04 05:42 PM
Adding values in textboxes... Jake Marx[_3_] Excel Programming 0 July 27th 04 05:38 PM
Adding the values of 2 textboxes Ben Allen Excel Programming 3 April 29th 04 09:05 PM
Add values of textboxes together Candee[_10_] Excel Programming 4 December 5th 03 07:05 PM


All times are GMT +1. The time now is 07:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"