+ Reply to Thread
Results 1 to 4 of 4

Adding Trailing Zeroes

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,065

    Adding Trailing Zeroes

    I need a macro to do a comparison between two spreadsheets, and one part of it is throwing me, as I need to compare apples to oranges. Here's the situation:

    Sheet A has the data noted like this:
    PAC
    11000
    11100
    11500, etc.
    All data should have 5 digits, and my numbers range from 11000 to 87028, though quite a few are skipped.

    Sheet B has data like this:
    PAC
    110
    110-CBS
    11000
    11100-ING
    112
    11500-L

    How can I change sheet B to:
    1) Drop off the dash and anything following?
    2) Add trailing zeroes to make sure all numbers are 5 characters in length?


    Thanks in advance for any help. I don't have any code to poste on this because I'm just about to start writing it, but need this part first.
    Last edited by jomili; 12-29-2009 at 12:09 PM. Reason: Solved

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Adding Trailing Zeroes

    Hi, This is possible one way !!
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Adding Trailing Zeroes

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,065

    Re: Adding Trailing Zeroes

    Wow! You guys rock!

    MickG, your solution worked right off the bat, quick and pretty. Thanks loads!

    MikeRickson, your solution halfway worked. It DID remove all of the stuff from the dash on, but it did NOT change the 3-digit numbers (like 110) to 5 digit (like 11000).

    I'll mark this question solved, and thank you both for being so quick. Mike, if you have any idea why your solution only halfway worked I'd be interested in hearing it.

    Thanks, and Happy New Year!

+ 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