Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Modifiying a text number ( 12345 ) to have exactly 6 digit with a 0 in front

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Modifiying a text number ( 12345 ) to have exactly 6 digit with a 0 in front

Thank you very much for the quick reply, but how do I use
this code?

-----Original Message-----
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



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Modifiying a text number ( 12345 ) to have exactly 6 digit with a 0 in front

OK it's fine I found out how to make your code work. I am
new with macros and excell!

Simon
-----Original Message-----
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



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How add a digit to front of number in each cell in excexl column Killarney Tom Excel Discussion (Misc queries) 2 April 5th 23 01:10 PM
how do I add a zero in front of a bunch of 4 digit numbers? Jenilise Excel Discussion (Misc queries) 7 November 3rd 07 12:39 AM
How do I add a zero in front of a text formatt number? p210driver Excel Worksheet Functions 3 November 14th 06 02:41 AM
formating the number from 12345.1 to 12345.001 sr25 Excel Discussion (Misc queries) 7 November 29th 05 03:51 PM
how can i get a cell to hold a zero in front of a digit ie. 01 or. Southern Belle Excel Discussion (Misc queries) 2 February 2nd 05 09:56 PM


All times are GMT +1. The time now is 11:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"