+ Reply to Thread
Results 1 to 7 of 7

Macro to convert zip code +4 format to text format

  1. #1
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Macro to convert zip code +4 format to text format

    Hi ,

    I need to convert cells having zip code + 4 format to text format because I am not able to see leading zeros and dash in the cell but visually it appears.I am using excel 2010.
    Any help would greately appreciated.
    Thanks

  2. #2
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Macro to convert zip code +4 format to text format

    Hi Narendra..

    Some of Forum member are not from USA, or even not idea.. what is "zip code + 4" format looks like..
    however, If they can able to see some of the format or sample file with expected output, may be some Non-USA will also give a try..
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Macro to convert zip code +4 format to text format

    Have you seen the Cell Format made for Zip Codes + 4? Read:
    http://www.dummies.com/how-to/conten...r-formats.html
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Re: Macro to convert zip code +4 format to text format

    Hi,
    Actually I have a column of zip code for that we need to append leading zeros to make 5 character lengh for those which are >3 character length and <5 character length and highlihght the value which is less than 3 character and also convert the cells into text format for importing purpose.
    I am using this code but it is loosing dash and leading zeros which are already have 5 character length.
    For example
    The below code will provide the output
    27773239 but visually I can see as 02777-3239
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by narendrabr; 12-16-2014 at 01:54 PM.

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Macro to convert zip code +4 format to text format

    so what was wrong with the functions in your other thread?
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  6. #6
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Re: Macro to convert zip code +4 format to text format

    Actually the code is not retaing leading zeros and dash and it is just converting the cells as text using this code
    rng.NumberFormat = "@"

    Thanks

  7. #7
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Re: Macro to convert zip code +4 format to text format

    Hi,
    The above code is working fine if the cell is already text data type but if it is in zipcode+4 format it is not displaying leading 0 and dash.

    Thanks!

+ 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. Macro to convert Text to Date format
    By akynyemi in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-17-2013, 12:18 PM
  2. Convert date and time in serial number format to text format
    By nda13112 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-11-2013, 02:45 PM
  3. Convert to Text Format Macro
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-16-2013, 08:31 AM
  4. Convert a Date Format to a text format
    By ADArnold in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-08-2008, 08:27 AM
  5. Convert numbers from text format to number format
    By merlin68 in forum Excel General
    Replies: 4
    Last Post: 04-12-2005, 09:06 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