Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Number Format in VBA
How to a force VBA to show an integer as a fixed number of digits? eg
display 240 as 0000240 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Number Format in VBA
Set the format (FormatCellsCustom) to 0000000
-- HTH Bob Phillips (there's no email, no snail mail, but somewhere should be gmail in my addy) "PhilM" wrote in message oups.com... How to a force VBA to show an integer as a fixed number of digits? eg display 240 as 0000240 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Number Format in VBA
Hi Phil
Assuming you want your variable myVar to hold this value: myVar = Format(240,"0000000") Note that this is held as a string value. If you simply want to display 240 in your sheet in the desired format, then you need to set the number format of the cell that holds the value: Range("A1").Value = 240 Range("A1").NumberFormat = "0000000" Hope this helps! Richard PhilM wrote: How to a force VBA to show an integer as a fixed number of digits? eg display 240 as 0000240 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Number format in cells | Excel Worksheet Functions | |||
Convert [h]:mm sum total format to number format | Excel Worksheet Functions | |||
Number format for Combobox | Excel Discussion (Misc queries) | |||
16 digit number wont keep alteration unless format cell to text | Excel Discussion (Misc queries) | |||
How do i change numbers in text format to number format? | New Users to Excel |