Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default incorrect addition

I have three textboxes:
Contents Premium name:contents
Bldg Premium name:bldg
Total Premium name:total

Total.Value = Contents.Value + Bldg.Value
When I add the above line to calculate the total premium, it does not
add, it concatenates. eg. if I put 10000 in Contents Premium and 50 in
Bldg Premium, ideally it should show 10050 but it is showing 1000050

Total.Value = Contents.Value - Bldg.Value
The above line for subtracting works fine.

Any ideas???

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default incorrect addition

Total.Value = Sum(Contents.Value, Bldg.Value)

wrote in message
ps.com...
I have three textboxes:
Contents Premium name:contents
Bldg Premium name:bldg
Total Premium name:total

Total.Value = Contents.Value + Bldg.Value
When I add the above line to calculate the total premium, it does not
add, it concatenates. eg. if I put 10000 in Contents Premium and 50 in
Bldg Premium, ideally it should show 10050 but it is showing 1000050

Total.Value = Contents.Value - Bldg.Value
The above line for subtracting works fine.

Any ideas???



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default incorrect addition

Your TEXT boxes contain text, so VBA will add the two text strings
together as you have requested - two options for you

(1) store the results of the textboxes on the worksheet and have a
formula to sum them
(2) amend your code to be
total.value=val(contents.value)+val(Bldg.Value)

wrote:
I have three textboxes:
Contents Premium name:contents
Bldg Premium name:bldg
Total Premium name:total

Total.Value = Contents.Value + Bldg.Value
When I add the above line to calculate the total premium, it does not
add, it concatenates. eg. if I put 10000 in Contents Premium and 50 in
Bldg Premium, ideally it should show 10050 but it is showing 1000050

Total.Value = Contents.Value - Bldg.Value
The above line for subtracting works fine.

Any ideas???


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
Addition? Frodo Excel Discussion (Misc queries) 3 July 22nd 06 01:15 PM
Sum vs. Addition davegb Excel Programming 4 May 19th 06 09:03 PM
addition dali New Users to Excel 1 March 4th 06 06:40 PM
row addition Threshold Excel Worksheet Functions 3 March 17th 05 08:08 PM
Addition to code gav meredith Excel Programming 0 April 29th 04 02:05 AM


All times are GMT +1. The time now is 12:17 PM.

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

About Us

"It's about Microsoft Excel"