FormatSSN

  • Thread starter Thread starter jb
  • Start date Start date
J

jb

Does anyone have the VBA code that will take a SSN and put the - in it?
I usually use the format cell, but the last couple of spreadsheets I
have worked on will not recognize the command for some reason.

Thanks
 
Try something like

SSN = Format(123456789, "000-00-0000")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Suspect your SSN's are stored as text rather than numbers. You can test by
selecting the column and do

Edit=>Goto=>Special and select Constants and Text. If it selects all your
SSN's then that is the problem.

You need to format the cells as General, then do

Data=>Text to Columns, select delimited and select tab as the delimiter.
This will cause excel to reevaluate your SSN's and change them to numbers.
Then your format should work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top