comma vs period

TimvanSprang

New Member
Joined
Feb 23, 2014
Messages
10
Hello,

If you have time to assist me with a problem I would be verry greatfull.

I created a userform that can be used to fill out an excel sheet. I
added the option to fill al the textboxes with pre-entered data using
a combobox.

So for example,

Textbox one is filled with the value of B1 when option one is selected
in the combobox.

After that the values in the textboxes are transfered to excel and
used to calculate a profit margin.

My problem arises when cell B1 is the reuslt of a formula, for example
(B2*B3/B4) = 4,890

This value is transferred to the textbox in the userform and still looks like 4,890 so
far so good.

But when I transfer the textboxvalue back to excel to use it in de
profit calculations. Suddenly the targetcell is filled with 4.890 a
point instead of a comma en thereby messing up my calculations.

I hope you have encountered this problem before and can tell my how to fix it.

Thanks a lot,
cleardot.gif

 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Try amending the code that writes the textbox value back to the worksheet so that it converts the value to a number.

For example:
Rich (BB code):
Range("A1").Value = CDbl(Me.TextBox1.Value)
 
Upvote 0
Thank you. It worked I think. I changed the code from

Worksheets("bereken zeugen").Range("E2").Value = TB11a.Value
Worksheets("bereken zeugen").Range("E3").Value = TB11b.Value
Worksheets("bereken zeugen").Range("E4").Value = TB11c.Value
Worksheets("bereken zeugen").Range("E5").Value = TB11d.Value
Worksheets("bereken zeugen").Range("E6").Value = TB11e.Value



Worksheets("bereken zeugen").Range("E2").Value = TB11a.Value
Worksheets("bereken zeugen").Range("E3").Value = TB11b.Value
Worksheets("bereken zeugen").Range("E4").Value = TB11c.Value
dMyvalue = CDbl(TB11d.Text)
Worksheets("bereken zeugen").Range("E5").Value = dMyvalue
Worksheets("bereken zeugen").Range("E6").Value = TB11e.Value

If someone knows a way to do this for all the textboxes at once that would help me even further.

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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