Z
zootieb
On a userform I have three textboxes. Two that people use to enter amounts
and a third that automatically displays the sum of the two amounts.
amount1.text
amount2.text
total.text
In the Total Textbox I use this (code borrowed from another thread):
Total.Text = Val(Amount1.Text) + Val(Amount2.Text)
This works if the amounts are under 1,000.00 but when the amounts are over
1,000 the code reads to the decimal. For example:
Example 1 Under 1,000
----------------
Amount1 = 500.00
Amount2 = 500.00
Total = 1,000.00
Example 2 Over 1,000
-----------------
Amount1 = 500.00
Amount2 = 10,000.00 <= sees 10,000 as just 10
Total = 510.00 <= should be 10,500.00
I think the problem is caused by using the Val function. I have tried using
CDbl but then I get a "Type mismatch" error if one of the Amount Textboxes
are blank. I guess it is expecting a number and gets a blank space instead.
What am I doing wrong? Any suggestions would be much appreciated.
Overall this problem is only a small part of an awesome spreadsheet, however
after working on this specific issue for three days I thought it better to
throw in the towel and ask for help.
So HELP!! Anyone?
and a third that automatically displays the sum of the two amounts.
amount1.text
amount2.text
total.text
In the Total Textbox I use this (code borrowed from another thread):
Total.Text = Val(Amount1.Text) + Val(Amount2.Text)
This works if the amounts are under 1,000.00 but when the amounts are over
1,000 the code reads to the decimal. For example:
Example 1 Under 1,000
----------------
Amount1 = 500.00
Amount2 = 500.00
Total = 1,000.00
Example 2 Over 1,000
-----------------
Amount1 = 500.00
Amount2 = 10,000.00 <= sees 10,000 as just 10
Total = 510.00 <= should be 10,500.00
I think the problem is caused by using the Val function. I have tried using
CDbl but then I get a "Type mismatch" error if one of the Amount Textboxes
are blank. I guess it is expecting a number and gets a blank space instead.
What am I doing wrong? Any suggestions would be much appreciated.
Overall this problem is only a small part of an awesome spreadsheet, however
after working on this specific issue for three days I thought it better to
throw in the towel and ask for help.
So HELP!! Anyone?