Change separator to comma

Perbjo

New Member
Joined
May 5, 2022
Messages
30
Office Version
  1. 365
Platform
  1. Windows
Hi

I'm struggling with comma vs dot - I live in Denmark, and we have it totaly opposite english in relation to decimal separator.
I've made a userform where I can add a car to a list by typing name of the car and price pr. month.
It works great exept the price which wont put a comma unless i use the period button on my keyboard.
I've search MrExcel and other fora but without a solution I could adapt.
Do any of you know what to do?
1662369450101.png
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi,

would you be able to try Application.WorksheetFunction.Substitute(Range("B"&r).Value,",",".")

at the end of your code..
 
Upvote 0
Use CDbl not Val
 
Upvote 0
Solution
Thanks RobP
Unfortunately it doesn't work - but maybe I add it wrong:

r = Range("A" & Rows.Count).End(xlUp).Row + 1
Range("A" & r).Value = WorksheetFunction.Proper(Me.cboCarName)
Range("B" & r).Value = Val(Me.cboCarPrMonth)
Range("B" & r).Value = Application.WorksheetFunction.Substitute(Range("B" & r).Value, ",", ".")

And if I just add Application.WorksheetFunction.Substitute(Range("B" & r).Value, ",", ".") it turns red and don't execute.
 
Upvote 0
Hi,

I'm guessing your code stops at
Excel Formula:
Range("B" & r).Value = Val(Me.cboCarPrMonth)

Then, if you try indeed to use
VBA Code:
Range("B" & r).Value = CDbl(Me.cboCarPrMonth)
as @RoryA suggested, it should go through, and then you don't need my extra line of code.
 
Upvote 0
Hi,

I'm guessing your code stops at
Excel Formula:
Range("B" & r).Value = Val(Me.cboCarPrMonth)

Then, if you try indeed to use
VBA Code:
Range("B" & r).Value = CDbl(Me.cboCarPrMonth)
as @RoryA suggested, it should go through, and then you don't need my extra line of code.
It gives me this error in relation to CDb1:
1662389670102.png
 
Upvote 0

Forum statistics

Threads
1,214,904
Messages
6,122,169
Members
449,070
Latest member
webster33

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