Replace function on selected range

GerrardSVK

New Member
Joined
Sep 18, 2023
Messages
39
Office Version
  1. 2016
Platform
  1. Windows
Hello all.

please can anyone help me with replace function?
I have just simple range selected with numbers but I need to change dot into comma and degree mark with nothing See picture bellow.
Under I wrote my code but do not work properly somwhere its ok somewhere not.

1741599385623.png
 
None of solution works It seems that in my generated exel some nubers are considered as numbers some as text so it makes nonuniformity and whatever I used it still gets nonadequate results. I tried also conversion of cells from text to numbers and than makes conversion but still no change.
 
Upvote 0
See if this works,
Code:
Sub test()
    With Selection
        .Replace ChrW(176), "", 2
        .Value = Application.Substitute(.Cells, ".", ",")
    End With
End Sub
 
Upvote 0
Sub test() With Selection .Replace ChrW(176), "", 2 .Value = Application.Substitute(.Cells, ".", ",") End With End Sub
Still bad result I dont know where this magic comes from but in case of nuber like 0.084 there is dot as decimal point and in case of number like 23.245 dot is considered as thounad divider and whatewer of theese solution i tryed results still same there must be some magic that exel do not recognize format correctly.
 
Upvote 0
I got it like this.
Before/After is happening in the same range you selected.

Book1
EFG
1BeforeAfter
223.46523,465
33.78°3,78
40.76890,7689
53455.893455,89
60.005630,00563
70.0402°0,0402
80.0840,084
90.04040,0404
1023.24523,245
Sheet1
 
Upvote 0

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