Thread: Simple SSN UDF
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default Simple SSN UDF

What if you make a mistake and only enter 7 or 8 digits... do you want the
function to automatically add 2 or 1 leading zero automatically? Or enter
12e3? Or if you want to feed it a numeric constant like =SSN(123456789)?

Rick


"ToddEZ" wrote in message
...
works perfect. Thank you kindly.

"p45cal" wrote:

Function ssn(myrange As Range)
ssn = Format(myrange.Value, "000-00-0000")
End Function

--
p45cal


"ToddEZ" wrote:

Hello. I am struggling with my VBA knowledge. I would like to convert
the
following formula into a UDF (=ssn(cell)), but I do not know what the
code
will look like. Can anyone help?

Formula:
=text(cell, "000-00-0000")

Thanks!