Dim strTest As String
strTest = "0001-0002-0003"
MsgBox Replace(strTest, "-", "")
will display:
000100020003
It must be put in as a string.
Code:
Dim strTest As String
strTest = 0001-0002-0003
MsgBox Replace(strTest, "-", "")
will display:
4
0001-0002-0003 becomes 1-2-4
1 - 2 = -1,
-1 - 3 = -4
and the -4 becomes....4 as the - is replaced.
The reason I posted this is because the OP did NOT specify this is for Excel. So using SUBSTITUTE(A1,"-","") is just more of that it must be an Excel question spreadsheet-centricity.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.