• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Adding zero as prefix Cells with Zeros

hmm...
Do anyone else wonder,
why those sample files are good to get?
That B-column's all original values are not numbers ... text maybe ...
and someway should add "00000"...
 
we have CIN numbers which are 10 digit numbers prefix and downloaded data comes with only 5 digit need to add prefix 00000 zeros in "B" column and not sure if this possible with excel formula or vba, please suggest.
Try
Code:
Sub test()
    With Range("b1", Range("b" & Rows.Count).End(xlUp))
        .Value = Evaluate("if(" & .Address & "<>"""",if(isnumber(" & .Address & "),text(" & .Address & ",""0000000000"")," & .Address & "))")
    End With
End Sub
 
Last edited:
Back
Top