function to deal text with number together in textbox on userfrom after sum

MKLAQ

Active Member
Joined
Jan 30, 2021
Messages
415
Office Version
  1. 2016
Platform
  1. Windows
Hello,
I'm not sure if what I ask for it , is it possible !
so I have number format & text in first digit , the second digit will be space in textbox15 like this
ATRB 1,000.00 and textbox16 will be like this ATRB 15,000.00. so what I look for when sum textbox15+textbox16 then textbox17 will be like this " ATRB 16,000.00 "
I have VAL function but it's useless in this case.
VBA Code:
TextBox17.Value = Val(TextBox15.Value) + Val(TextBox16.Value)
any function to deal with this case guys?
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
VBA Code:
TextBox17 = Split(TextBox15)(0) & " " & Val(Split(TextBox15)(1)) + Val(Split(TextBox16)(1))
 
Upvote 0
Hi,
it doesn't show correct result in textbox17
example: textbox15=ATRB 1,000.00 , textbox16= ATRB 1,000.00
then the correct result will be ATRB 2,000.00 .
based on your code will be =ATRB 2 !
 
Upvote 0
Because you have a comma in your numbers, which is not a thousand separator in your case
 
Upvote 0
this is until make easy to read numbers . so there is no way to solve this problem?
 
Upvote 0
yes you have to write your numbers differently, so don’t use a comma as thousand separator. Use a dot instead. Comma for decimals
 
Upvote 0
How is that bad news ;)
you said
yes you have to write your numbers differently, so don’t use a comma as thousand separator. Use a dot instead. Comma for decimals
I expect you're talking about this
1.PNG


and use comma as I said
this is until make easy to read numbers
and I try to change your suggestion by use replace function and this is what I got
VBA Code:
TextBox17.Value = Split(TextBox15)(0) & " " & Val(Replace(Split(TextBox15)(1), ",", "")) + Val(Replace(Split(TextBox16)(1), ",", ""))
2.PNG


and what I want
3.PNG

now I face problem in textbox17 should show #,##0.00
 
Upvote 0

Forum statistics

Threads
1,222,902
Messages
6,168,938
Members
452,227
Latest member
sam1121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top