+ Reply to Thread
Results 1 to 3 of 3

Formatting column

  1. #1
    Brent E
    Guest

    Formatting column

    I've got an Excel workbook that contains many license numbers and I need to
    format the column so that if a license number has several 0s in front, they
    aren't automatically truncated by Excel. I tried general, number, and text
    formats but they truncate leading 0s. Any ideas? Thanks.

  2. #2
    Registered User
    Join Date
    04-21-2005
    Posts
    46
    Try using the "custom format" option. Type in 000000000 for the 'type'. Use as many 0's as you have digits in your license plate.

  3. #3
    Edwin Tam
    Guest

    RE: Formatting column

    You may try running the code below which should effectively remove all
    leading zero from the selected cells.

    Sub truncate_zero()
    Dim cell As Object, tmp
    For Each cell In Selection.Cells
    tmp = cell.Value
    If Left(tmp, 1) = 0 Then
    Do Until Left(tmp, 1) <> 0
    tmp = Right(tmp, Len(tmp) - 1)
    Loop
    cell.Value = tmp
    End If
    Next
    End Sub


    Regards,
    Edwin Tam
    [email protected]
    http://www.vonixx.com


    "Brent E" wrote:

    > I've got an Excel workbook that contains many license numbers and I need to
    > format the column so that if a license number has several 0s in front, they
    > aren't automatically truncated by Excel. I tried general, number, and text
    > formats but they truncate leading 0s. Any ideas? Thanks.


+ 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