+ Reply to Thread
Results 1 to 5 of 5

VBA to fix ZipCodes

  1. #1
    Registered User
    Join Date
    04-27-2011
    Location
    Virginia, US
    MS-Off Ver
    Excel 2007
    Posts
    11

    VBA to fix ZipCodes

    In my file I have a column with zipcodes. Some times the zipcodes are only 4 digits because the 0 in front was dropped. Is there code I can put in that would add the leading zero wehn it is four digits and format the column to text?

  2. #2
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: VBA to fix ZipCodes

    Assuming your zips are in Column A and that you will run the code after selecting the sheet to modify:
    Please Login or Register  to view this content.
    If your question has been satisfactorily addressed, please consider marking it solved. Click the Thread Tools dropdown and select Mark thread as solved.
    Also, you might want to add to the user's reputation by clicking the star icon in the lower left corner of the post with the answer- it's why we do what we do...

    Thomas Lafferty
    Analyst/Programmer

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

    Re: VBA to fix ZipCodes

    Hi davidsons,

    There is a custom format of zip codes in most versions of excel.
    Or see if any of these links help.
    http://office.microsoft.com/en-us/ex...010274823.aspx
    http://excel.tips.net/T002793_Sorting_ZIP_Codes.html
    http://www.ofzenandcomputing.com/zanswers/3552/
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    04-27-2011
    Location
    Virginia, US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: VBA to fix ZipCodes

    I couldn't get it to work and tried to modify the code, but it is still not working. Any suggestions?

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by davidsons; 04-28-2011 at 01:05 PM.

  5. #5
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: VBA to fix ZipCodes

    Can you attach a sample of your workbook?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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