padding cell with up to 3 zeros

J

Jock

I need users to input a four digit number between 0001 and 9999 in cells in
column "B".
Rather than forcing the user to enter leading zeros, is there a way, either
using code or formula, to automate the process meaning the user can input
"55" for instance, and Excel will automatically add the two leading zeros?
I have also set up a 'Custom' number type (format cells) which will place
"09/" in front of each entry in column "B". This would need to be taken into
account.
Example - 09/0055

Thanks,
 
J

Jock

That'll do nicely - Thanks Rick
--
Traa Dy Liooar

Jock


Rick Rothstein said:
If you use this Custom Formatting pattern...

"09/"0000

Then the cells you apply it to will **display** the user's entries as you
want them to appear; so, if your user enters 55 in the cell, it will display
as 09/0055. Note, however, that the entry in the cell will still be 55... it
will only **look** like 09/0055. Is that what you were after, or did you
want to physically change the entry to actually be 09/0055? If so, that will
require VB code.
 

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