Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you use a numberformat of Text (or "@" in code), then whatever you plop into
that cell will be kept. If you want leading 0's, you'll have to put them there yourself. Dim myNum As Long myNum = 1234 With ActiveCell .NumberFormat = "@" .Value = Right(Format(myNum, String(10, "0")), 10) End With omsoft wrote: I have Excel 2007 worksheet. Besides other data, it contains productnumbers (10 digits). Some of this product # begin with 0. The sheet is formatted as General. This sheet is used as an input into another app which can not take text as format. Does anyone know how do I format product # so that leading zeros are preserved? I tried it as "@" and "0000000000" and in Excel it looks like there is a leading zero, it is just formatting and gets dropped in the other app. How do I do this? I am creating this worksheet using VBA. Thanks much. -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Leading Zeros | Excel Discussion (Misc queries) | |||
Importing to Excel from csv AND keep leading zeros | Excel Discussion (Misc queries) | |||
Excel Leading Zeros | Excel Discussion (Misc queries) | |||
leading zeros in excel | Excel Discussion (Misc queries) | |||
save text field w/ leading zeros in .csv format & not lose zeros? | Excel Discussion (Misc queries) |