View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
John Michl[_2_] John Michl[_2_] is offline
external usenet poster
 
Posts: 27
Default Modifiying a text number ( 12345 ) to have exactly 6 digit with a 0 in front

If you don't want to change them to text but just want leading zeros, you
can also use a custom format. Highlight the cells, right click and select
Format Cells, click the Number tab, select Custom from the list of options
and then in the Type box, type 000000.

- John Michl



"Dana DeLouis" wrote in message
...
Just another general idea if you want to change numbers to text. Here,

the
prefix character for text is included in the format.

Sub Test()
Dim cell As Range
For Each cell In Range("A1:A20").Cells
cell = Format(cell, "'000000")
Next
End Sub

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"simon.guertin" wrote in message
...
Hi, How can I parse my excell column that contains numbers
(I changed them to be text) I want to put zeros in front
so the number has 6 digit. the number may have 3 4 or 5
digit so I need to fill 0 in front so it is 001234
thank you

Simon