Replace function for partial characters

GerrardSVK

New Member
Joined
Sep 18, 2023
Messages
29
Office Version
  1. 2016
Platform
  1. Windows
Hi everyone could someone help me I just need to write simple macro that will change number from this format: 1.234 into format using comma instead of dot : 1,234
Also I need to change sign of degrees into nothing. So if there will be some number like this 1.234° final result will be 1,234.

I tried this but dont work:
Sub Replace()

Workbooks(2).ActiveSheet.Range("G9:G136").Replace What:=".", Replacement:=","
Workbooks(2).ActiveSheet.Range("G9:G136").Replace What:="°", Replacement:=""

End Sub

I think there have to be additional xlPart defined or something.
 
OK. I'm not sure that I can be of any further assistance. The file you shared is a comma delimited csv with all the values in column A - I'm not sure what process you undertake to get those values into column G so as to match your original post requirements. In any event, I ran the code on column A to see whether it would remove the degree symbol & convert the periods to commas - and it seemed to. Therefore, I cannot duplicate the issue you're having with the code. Here's a link to the file you shared after I ran the code on column A.
1.kus_kavita.csv
1696928399548.png

Try it on these columns
 
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
yes you are right its not corect so thats why I told you to aply it on that diferent colums(D9:D136) where decimal numbers are divided by dot
But there's nothing in those columns. They are blank. For the 3rd time, all the values are in column A, comma delimited (semi colon in your region settings it seems) so I would be applying the code to blank columns.
 
Upvote 0
But there's nothing in those columns. They are blank. For the 3rd time, all the values are in column A, comma delimited (semi colon in your region settings it seems) so I would be applying the code to blank columns.
Oh sorry so there is probably something wrong with file I try tu send you new one:

Try this one there should be values with dot in column G9-G136

 
Upvote 0
OK I ran the code on column D (D9:D136).
Before:
2.kus_kavita3.xlsx
D
973.300°
105.5
1151.6
1248
1338.3
1436.95
150
1630
170
1829
1920.8
2016.3
2110.4
226
236
2410
252
2616
2722.6
281.9
2916.4
3010.1
310
326
336
3410.4
3516.2
3610
3716
3822.6
391.9
4030
419
422
430
440
450
460
470
4816.3
4910.4
506
516
5210
532
5416
5522.6
561.9
5716.4
5810.1
590
606
616
6210.4
6316.2
6410
6516
6622.6
671.9
6830
699
702
710
720
730
740
750
7616.15
7721.4
7812
7911.5
8025
8117
821.8
8321.5
8415.9
850
862.3
8712
8812
8916.3
9021.3
9111.5
9217
9325
941.8
9530
963.7
9712.7
9812
992.7
1000
1010
1020
1030
1040
10513.9
10611.9
10711
10811.7
1090.8
1100.8
11130.000°
1123
1131.2
11490.000°
1152.8
1162.8
11724.9
11825.8
11927.8
12021
12111.2
12213.1
12313.9
12414
1256
12612
1274
1283.25
129250
130116.3
13158.6
132252.7
13362.3
134142.5
1352.9
1362.9
2.kus_kavita3


After:
2.kus_kavita3.xlsx
D
973,300
105,5
1151,6
1248
1338,3
1436,95
150
1630
170
1829
1920,8
2016,3
2110,4
226
236
2410
252
2616
2722,6
281,9
2916,4
3010,1
310
326
336
3410,4
3516,2
3610
3716
3822,6
391,9
4030
419
422
430
440
450
460
470
4816,3
4910,4
506
516
5210
532
5416
5522,6
561,9
5716,4
5810,1
590
606
616
6210,4
6316,2
6410
6516
6622,6
671,9
6830
699
702
710
720
730
740
750
7616,15
7721,4
7812
7911,5
8025
8117
821,8
8321,5
8415,9
850
862,3
8712
8812
8916,3
9021,3
9111,5
9217
9325
941,8
9530
963,7
9712,7
9812
992,7
1000
1010
1020
1030
1040
10513,9
10611,9
10711
10811,7
1090,8
1100,8
11130,000
1123
1131,2
11490,000
1152,8
1162,8
11724,9
11825,8
11927,8
12021
12111,2
12213,1
12313,9
12414
1256
12612
1274
1283,25
129250
130116,3
13158,6
132252,7
13362,3
134142,5
1352,9
1362,9
2.kus_kavita3
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,212
Members
452,618
Latest member
Tam84

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