View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Marcelo Marcelo is offline
external usenet poster
 
Posts: 1,047
Default How do I format a social security number to have no dashes?

Hi Kim,

Copy this function and paste as a new Module (press Alt+F11)

use a function =digitsonly(a2)
hth
regards from Brazil
Marcelo
********************************************
Public Function DigitsOnly(sStr As String) As Variant
Dim oRegExp As Object

Set oRegExp = CreateObject("VBScript.RegExp")

With oRegExp
.IgnoreCase = True
.Global = True
oRegExp.Pattern = "\D"

DigitsOnly = oRegExp.Replace(sStr, vbNullString)
End With
End Function
********************************************



"kim" escreveu:

I have a column in Excel with social security numbers and i need to make the
formatting so the number has no dashes in it. So for instance 111-11-1111,
should look like 11111111. Is there a quick way to format my column to look
like this??

Thanks

Kim