View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Modifiying a text number ( 12345 ) to have exactly 6 digit with a 0 in front

Dim i as long, cell as Range
i = 1
do while not isempty(cells(i,1))
set cell = cells(i,1)
cell.Value = "'" & Right("000000" & cell.value,6)
i = i + 1
Loop


Change the 1 to refer to the column you want to parse.
--
Regards,
Tom Ogilvy

"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