+ Reply to Thread
Results 1 to 4 of 4

VB Code to format to SS #

  1. #1
    Forum Contributor
    Join Date
    01-31-2012
    Location
    Georgia
    MS-Off Ver
    Excel 2010
    Posts
    194

    VB Code to format to SS #

    Hello:

    I have numbers in column F as 123456789 format.
    I need VB Code to do following.

    1st check if total digit is 9 character, if less then 9 character than add "0" in front

    Then format the cell value to 123-45-6789 format

    Example : 67667779, so this is 8 digit ..this will need to be 067667779

    and then to get to proper format to 067-66-7779

    Let me know if any questions

    Riz

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,631

    Re: VB Code to format to SS #

    Are you still using XL2010 ? If not please update your profile. Ths
    Do you really need VBA ? A formula will also do the trick

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,920

    Re: VB Code to format to SS #

    Removed by JT
    Last edited by JohnTopley; 12-06-2023 at 12:14 PM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: VB Code to format to SS #


    Hello,

    no need any VBA procedure just using Excel basics so directly with just an appropriate obvious cell format (without any formula) …

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Code to format dollar amount of an excel cell to Accounting format in HTMLBody of email
    By LilSisKin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-21-2021, 10:34 AM
  2. [SOLVED] TEXT(value, format_text) - format code to format as superscript?
    By Aval in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-04-2020, 07:18 AM
  3. [SOLVED] VBA Code to format a column to a specific number format
    By TreeLife in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-24-2018, 09:26 PM
  4. vba code to format a column to a specific format (SSSS X1111111)
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-18-2017, 03:16 PM
  5. Macro to convert zip code +4 format to text format
    By narendrabr in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-17-2014, 09:42 AM
  6. [SOLVED] help on vba code to change the error date format as standard format mm/dd/yyyy
    By johnodys in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-13-2013, 01:10 AM
  7. Replies: 0
    Last Post: 10-06-2006, 09:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1