Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove the dash

Status
Not open for further replies.

tj63069

IS-IT--Management
Feb 13, 2003
59
US
Other than "Left" "Right" how can I remove the dash from a number...ie 0001-0002-0003 to form one number ie 000100020003
 
You can do Edit/Replace:

for find put -
for replace put nothing

BUT, This will turn it into a number and take off your leading 0's


[Blue]Blue[/Blue] [Dragon]

If I wasn't Blue, I would just be a Dragon...
 
Code:
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.

<grin>

No offence intended.

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top