VBA function to remove automatically the "," in a text (example : 67,203.20 to 67202.20)

michelcoulon

New Member
Joined
Mar 6, 2018
Messages
3
Hi,

Can you explain me how to remove automatically the "," in a text (example : 67,203.20 to 67202.20) ?
It seems possible via VBA but I never use it.

Thanks in advance.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Welcome to the Board!

I assume that you have a typo, because I don't think you meant to change the actual value/numbers too:
67,203.20 to 67202.20
You can use the REPLACE function in VBA, i.e.
Code:
    Dim x As String
    x = "67,203.20"
    
    MsgBox Replace(x, ",", "")
 
Upvote 0
Welcome to the Board!

I assume that you have a typo, because I don't think you meant to change the actual value/numbers too:

You can use the REPLACE function in VBA, i.e.
Code:
    Dim x As String
    x = "67,203.20"
    
    MsgBox Replace(x, ",", "")

I indeed a Typo.

But isearch a solution like, I have full column and with a simple button, I remove all "," in all the fields
 
Upvote 0
Have you just tried Excel's built in Find/Replace functionality, just replacing the comma with nothing?
If you need it to be VBA code, just turn on the Macro Recorder and record yourself doing that manually, and you will have VBA code that does it.
 
Upvote 0
Hi,

I find the solution, I create a button who call this function :

Sub ReplaceTitleMs()
Columns("C").Replace What:=",", _
Replacement:="", _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False, _
SearchFormat:=False, _
ReplaceFormat:=False
End Sub
 
Upvote 0
I find the solution, I create a button who call this function :

Sub ReplaceTitleMs()
Columns("C").Replace What:=",", _
Replacement:="", _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False, _
SearchFormat:=False, _
ReplaceFormat:=False
End Sub
Yes, that is very similar to the code you would get if you used the Macro Recorder process I mentioned in my last post.

The Macro Recorder is a great tool to get snippets of code, without actually having to know VBA at all. It is a great tool for the beginner and advanced user alike.
 
Upvote 0

Forum statistics

Threads
1,215,741
Messages
6,126,596
Members
449,320
Latest member
Antonino90

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