+ Reply to Thread
Results 1 to 10 of 10

Retain Zero in front

  1. #1
    Valued Forum Contributor tek9step's Avatar
    Join Date
    05-27-2009
    Location
    London, England
    MS-Off Ver
    MS 365
    Posts
    389

    Retain Zero in front

    Hello

    I few values in column B which start with Zeros and on a vb form those (8 digit)values are being picked up by drop down box to be place in a new sheet. when copied over to new sheet it is removing the zeros in the front. The output sheet is a txt file and i would to retain the zeros in the front of the value.

    e.g

    00789876
    06784367
    00007539
    50667298
    00725637

    output appearing
    789876
    6784367
    7539
    50667298
    725637

    How can i stop this.

    Thanks

    regards
    Last edited by tek9step; 02-26-2010 at 06:56 AM.

  2. #2
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Retain Zero in front

    The first list are TEXT values.

    Copying these will result in a VALUE and then the zero's are not retained.

    Yo can prevent this by copying VALUES and NUMBER FORMAT in the paste special options.
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  3. #3
    Valued Forum Contributor tek9step's Avatar
    Join Date
    05-27-2009
    Location
    London, England
    MS-Off Ver
    MS 365
    Posts
    389

    Re: Retain Zero in front

    Hi rwgrietveld

    It still is removing zeros in front even after copying over column B as values number format.

    Regards

  4. #4
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Retain Zero in front

    Are you sure that you used the right option. See attachement.

    What is the current format of the cell?
    Attached Images Attached Images

  5. #5
    Valued Forum Contributor tek9step's Avatar
    Join Date
    05-27-2009
    Location
    London, England
    MS-Off Ver
    MS 365
    Posts
    389

    Re: Retain Zero in front

    Yes done the same no result

    I have attached a sample file..

    regards
    Attached Files Attached Files

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Retain Zero in front

    perhaps something like
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  7. #7
    Valued Forum Contributor tek9step's Avatar
    Join Date
    05-27-2009
    Location
    London, England
    MS-Off Ver
    MS 365
    Posts
    389

    Re: Retain Zero in front

    Hi Pike

    Could you please tell me how and where to place this code ?

    Please Login or Register  to view this content.

    regards
    Last edited by tek9step; 02-26-2010 at 07:45 AM.

  8. #8
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Retain Zero in front

    The code is for write to a txt file
    you may only need to use "custom format" the cells to 00000000
    it hard to say what you are doing from the snipet of workbook code

  9. #9
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Retain Zero in front

    I'm confused,

    Are we still discusing the same topic here. This is a EXCEL GENERAL topic, not a PROGRAMMING topic.

    Next: your sample WB does not contain a UserForm or any other code. Please explain.

  10. #10
    Valued Forum Contributor tek9step's Avatar
    Join Date
    05-27-2009
    Location
    London, England
    MS-Off Ver
    MS 365
    Posts
    389

    Re: Retain Zero in front

    Hi rwgrietveld

    yes we are still discussing the same problem of Zeros in front.. I was just trying to find a way to change the source without using any code (as special paste value number format didnt work) but pike has provided with a solution based on the question i raised.

    So this problem has fallen in between general & programme.

    I am ok for the moderator to move it to programming.

    regards

+ 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