ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   number format (https://www.excelbanter.com/excel-programming/279676-number-format.html)

Jo[_4_]

number format
 
Hi
I am trying to enter data onto a worksheet from a slide
bar on a userform. I need the number to be in a 5
character format i.e. if 5 is entered 00005 is displayed.
I can do this by formating to a zip code. The problem
occurs when I save as a text file, 00005 becomes 5 again.
Is there some code I could write which changes 5 to 00005?
Thanks
Jo

Tom Ogilvy

number format
 
ActiveCell.Value = "'" & right(format(Activecell.value,"00000"),5)

--
Regards,
Tom Ogilvy

"Jo" wrote in message
...
Hi
I am trying to enter data onto a worksheet from a slide
bar on a userform. I need the number to be in a 5
character format i.e. if 5 is entered 00005 is displayed.
I can do this by formating to a zip code. The problem
occurs when I save as a text file, 00005 becomes 5 again.
Is there some code I could write which changes 5 to 00005?
Thanks
Jo




Jez[_3_]

number format
 

You need to set a custom format. Select cells, right
click, format cells, number, custom. In the "type" box
eneter 0000# that will give you the format you are
looking for........

-----Original Message-----
Hi
I am trying to enter data onto a worksheet from a slide
bar on a userform. I need the number to be in a 5
character format i.e. if 5 is entered 00005 is

displayed.
I can do this by formating to a zip code. The problem
occurs when I save as a text file, 00005 becomes 5 again.
Is there some code I could write which changes 5 to

00005?
Thanks
Jo
.



All times are GMT +1. The time now is 07:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com