Append 0 character in cell value along with cell values in Excel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • akmughal
    New Member
    • Aug 2015
    • 1

    Append 0 character in cell value along with cell values in Excel

    I want to append "0" along with cell value if there is no "0" in beaning of cell value.

    Range of cells are S3:S100

    I tried the following logic but it does not work.
    Code:
    For Each cell In [S3:S100]
    If cell.value is not null then
    if left((cell.Value), 1) <> 0 Then
    cell.Value = "0" & cell.value
    End If
    Next cell
    Can anyone please help me
    Thanks
    Last edited by Rabbit; Aug 14 '15, 10:07 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • Luuk
    Recognized Expert Top Contributor
    • Mar 2012
    • 1043

    #2
    Easier would be to change the Format under Cell Properties to enough zero's.

    The value (i.e.) '42', with a format of '000' is displayed as '042'

    see: https://support.microsoft.com/en-us/kb/81518

    Comment

    Working...