Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
FormatSSN
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
FormatSSN
Try something like
SSN = Format(123456789, "000-00-0000") -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "jb" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
FormatSSN
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. -- Regards, Tom Ogilvy "jb" wrote in message ... 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
FormatSSN
Tom:
That was the problem. Thanks Tom Ogilvy wrote: 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|