+ Reply to Thread
Results 1 to 4 of 4

Copy data in a cell to the worksheet name with leading Zeros

  1. #1
    Registered User
    Join Date
    09-19-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    2

    Question Copy data in a cell to the worksheet name with leading Zeros

    Hi Guys,

    I am trying to take the value of a cell and use it to name the worksheet. The value in question will always have atleast one leading zero.

    In the source cell i have already set up the formatting so that the leading zeros are there.

    When i use the cell to set the ShtName it does not bring along the leading zeros.

    the value in the cell for example would be 01520012015 but when i use the same cell to name the worksheet it only gives me 1520012015 with no leading zero.

    Does anyone know how i can take the value to set the ShtName and have the leading zeroes there?

    Thank you in advance

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Copy data in a cell to the worksheet name with leading Zeros

    Place an apostrophe at the beginning of the value in the cell ... for example: '01520012015
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Copy data in a cell to the worksheet name with leading Zeros

    Provided your formatting is as Mumps indicated, I assume you are doing something like this with your code

    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor
    Join Date
    10-05-2014
    Location
    Regina, SK Canada
    MS-Off Ver
    Excel for Mac 11
    Posts
    330

    Re: Copy data in a cell to the worksheet name with leading Zeros

    Here's what I've done in a similar situation…
    Please Login or Register  to view this content.
    This way, no apostrophe is needed which would make that data Text rather than Numeric, and might affect other references to cell A1.
    All sheet names done this way would have the same length, 12 characters in this example.
    You could also get more creative in the format, perhaps a space after every 4th digit, which may make them easier to interpret. Just a thought.

    Hope this helps,
    - Stu

+ 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. Copy custom format without losing leading zeros
    By ucyzgba in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-14-2013, 09:47 AM
  2. Add leading zeros to existing data in a cell
    By jpartney in forum Excel General
    Replies: 1
    Last Post: 03-19-2008, 02:08 PM
  3. [SOLVED] How to copy a number into a text cell, keeping leading zeros?
    By Basher Bates in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 04-15-2006, 08:10 AM
  4. Replies: 1
    Last Post: 05-04-2005, 02:06 PM
  5. Replies: 2
    Last Post: 03-22-2005, 12:06 PM

Tags for this Thread

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