Removing comma from string (1 Viewer)

radek225

Registered User.
Local time
Today, 04:42
Joined
Apr 4, 2013
Messages
307
I would like to remove the comma, but only one that is at the end of my string(there is a space after the comma, should be also removed)
How should I do that in vba?
 

pr2-eugin

Super Moderator
Local time
Today, 11:42
Joined
Nov 30, 2011
Messages
8,494
How about.
Code:
? Left("Hello String, Welcome to my World, ", Len("Hello String, Welcome to my World, ")-2)
Hello String, Welcome to my World
 

JLCantara

Registered User.
Local time
Today, 04:42
Joined
Jul 22, 2012
Messages
335
Here is a more general solution to your question:

str = "coco rico, " ' Why not...
I = InStrRev(str, ",") ' Here is the trick: locate the comma from right to left
str = Mid(str, 1, I - 1) ' Typical transfer...
 

Users who are viewing this thread

Top Bottom