If you want to use a macro you can create a new module and paste the following code:
Function onlyDigits(s As String) As String
' Variables needed (remember to use "option explicit").
Dim retval As String ' This is the return string.
Dim i As Integer ' Counter for character position.
' Initialise return string to empty
retval = ""
' For every character in input string, copy digits to return string.
For i = 1 To Len(s)
If Mid(s, i, 1) >= "0" And Mid(s, i, 1) <= "9" Then
retval = retval + Mid(s, i, 1)
End If
Next
' Then return the return string.
onlyDigits = retval
End Function
(Credit to whoever wrote this code)
Then you can use the following formula...
Formula:
=TEXT(onlyDigits(A1),"000-000-0000")
Bookmarks