+ Reply to Thread
Results 1 to 13 of 13

Leading Zeros-Is this possible?

  1. #1
    Registered User
    Join Date
    06-07-2007
    Posts
    19

    Leading Zeros-Is this possible?

    Good Morning,

    I am looking for a way to ensure that all the leading zeros in one column are present without having to format the column cell be cell. Is this possible?

    Cheers

    Claire

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444
    Hi,

    Select the column you want to format with leading zeros, by clicking the column header.

    Go to Format > Cells > Number Tab > Text
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    06-07-2007
    Posts
    19
    Hi,

    Tried that, the problem is that the cells have already been populated but they don't seem to have been formatted, so by the time it reaches me I'm not sure if certain cells are supposed to have 1 or 2 leading zeros. Does that make sense? Looking for a solution to this as we are receiving worksheets with thousands of assets each month.

    Thanks

    Claire

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444
    So when you get this data it doesn't have the leading zeros?

  5. #5
    Registered User
    Join Date
    06-07-2007
    Posts
    19
    No, but it should have, it's being populated by different people and then passed to us, so I don't know if they're sheets have been formatted

  6. #6
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444
    If its the same workbook being populated every time, you could put this code in the workbook,

    Please Login or Register  to view this content.
    so it runs every time the workbook is opened, and formats the column to text. Then when it's populated it will always be formatted correctly.

  7. #7
    Registered User
    Join Date
    06-07-2007
    Posts
    19
    Cheers Dave , I'll try that.

    Claire

  8. #8
    Registered User
    Join Date
    06-07-2007
    Posts
    19
    Dave,

    Sorry being a bit dim, how do I enter the code that you've suggested?

    Claire

  9. #9
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  10. #10
    Registered User
    Join Date
    06-07-2007
    Posts
    19
    okay tried that, once you've pasted the code do you hit run or save, not very good at this type of thing and all the advice given is very welcome.

  11. #11
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444
    Once you've pasted the code, close the VBA editor, then save the worksheet and close it. The next time you open the sheet the code will run.

    Dave

  12. #12
    Registered User
    Join Date
    06-07-2007
    Posts
    19
    Yeah, it worked!

    Cheers everyone

  13. #13
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444
    Your welcome!

+ 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