Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I suspect that this is really easy but I haven't been able to figure out the solution. I have a form that holds a couple of numbers in text boxes, eg: TextBox1.Value is 2,000 TextBox2.Value is 12,500 What I want to do is add these two as numbers and display the answer in TexBox3. There will be no further manipulation of the value in TextBox3, so I don't actually care if it stored as a number or as text, so long as it is diaplayed as 14,500 TIA Dave TIA |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
If the commas aren't there you can use TextBox3.Value = Val(TextBox1.Value) + Val(TextBox2.Value) If the commas are real use TextBox3.Value = CLng(TextBox1.Value) + CLng(TextBox2.Value) Mike "Risky Dave" wrote: Hi, I suspect that this is really easy but I haven't been able to figure out the solution. I have a form that holds a couple of numbers in text boxes, eg: TextBox1.Value is 2,000 TextBox2.Value is 12,500 What I want to do is add these two as numbers and display the answer in TexBox3. There will be no further manipulation of the value in TextBox3, so I don't actually care if it stored as a number or as text, so long as it is diaplayed as 14,500 TIA Dave TIA |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You wanted the comma
myval = CLng(TextBox1.Value) + CLng(TextBox2.Value) TextBox3.Value = Left(myval, Len(myval) - 3) & "," & Right(myval, 3) Mike "Mike H" wrote: Hi, If the commas aren't there you can use TextBox3.Value = Val(TextBox1.Value) + Val(TextBox2.Value) If the commas are real use TextBox3.Value = CLng(TextBox1.Value) + CLng(TextBox2.Value) Mike "Risky Dave" wrote: Hi, I suspect that this is really easy but I haven't been able to figure out the solution. I have a form that holds a couple of numbers in text boxes, eg: TextBox1.Value is 2,000 TextBox2.Value is 12,500 What I want to do is add these two as numbers and display the answer in TexBox3. There will be no further manipulation of the value in TextBox3, so I don't actually care if it stored as a number or as text, so long as it is diaplayed as 14,500 TIA Dave TIA |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Many thanks
"Mike H" wrote: Hi, If the commas aren't there you can use TextBox3.Value = Val(TextBox1.Value) + Val(TextBox2.Value) If the commas are real use TextBox3.Value = CLng(TextBox1.Value) + CLng(TextBox2.Value) Mike "Risky Dave" wrote: Hi, I suspect that this is really easy but I haven't been able to figure out the solution. I have a form that holds a couple of numbers in text boxes, eg: TextBox1.Value is 2,000 TextBox2.Value is 12,500 What I want to do is add these two as numbers and display the answer in TexBox3. There will be no further manipulation of the value in TextBox3, so I don't actually care if it stored as a number or as text, so long as it is diaplayed as 14,500 TIA Dave TIA |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
myval = CLng(TextBox1.Value) + CLng(TextBox2.Value)
TextBox3.Value = Left(myval, Len(myval) - 3) & "," & Right(myval, 3) That last line can be made simpler using the Format function... TextBox3.Value = Format(myval, "0,000") -- Rick (MVP - Excel) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Convert long column to rows | Excel Discussion (Misc queries) | |||
How do I convert Easting/ Northing GPS coordinates into Lat/Long? | Excel Discussion (Misc queries) | |||
Convert multiple columns into one long row | Excel Discussion (Misc queries) | |||
Convert rows to one single long column? | Excel Discussion (Misc queries) | |||
How do you convert numbers as "text" to values for a long column . | Excel Discussion (Misc queries) |