Adding leading zeros

S

SITCFanTN

I'm converting an access report to excel and when I do, it is dropping the
leading zeros in column D and E. I need to write a macro to put the zeros
back in but my problem is that not every cell needs the zero added. Every
cell should be 6 alpha-numeric characters. If the data in the cell is only 4
characters, I need to add 2 leading zeros or if there is only 2 characters, I
would need to add 4 leading zeros. My spreadsheet very lengthy so I need a
macro to add the zeros, any help you can give me is appreciated, thank you.
 
B

Bob Phillips

Why not just format the column as 000000?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
P

PCLIVE

Format your cells using a customer format of
000000

That should do what you want.

HTH,
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top