Reputation: 3479
I need to change e.g. following string 153,154,155,156
to 153**,**154**,**155**,**156
so the ,
to **,**
How can I do that in VBA?
Upvotes: 1
Views: 154
Reputation: 33175
Not better, but different:
Sub SplitJoin()
Debug.Print Join(Split("153,154,155,156", ","), "**,**")
End Sub
Upvotes: 4
Reputation: 70344
Try this:
Dim s as String
s = "153,154,155,156"
s = Replace(s, ",", "**,**")
Upvotes: 3
Reputation:
Replace()
on MSDN
Sub ReplaceInStr()
Dim str As String
str = "153,154,155,156"
str = Replace(str, ",", "**,**")
MsgBox str
End Sub
Upvotes: 4