Trailing Zeros
I'm designing a combobox with decimal numbers. When I use .additem and type
in the numbers, it drops the trailing zeros. (ie. 0.500 becomes 0.5 automatically) I need the zeros for precision and consistancy purposes. Is there a line I can include in this code? With ComboBox1 .ListRows = 20 .AddItem (0.375) .AddItem (0.5) .AddItem (0.75) End With |
Trailing Zeros
Since they're text in the combobox, just add them as text:
With ComboBox1 .ListRows = 20 .AddItem "0.375" .AddItem "0.500" 'or even .AddItem format(0.75,"0.000") End With aftamath77 wrote: I'm designing a combobox with decimal numbers. When I use .additem and type in the numbers, it drops the trailing zeros. (ie. 0.500 becomes 0.5 automatically) I need the zeros for precision and consistancy purposes. Is there a line I can include in this code? With ComboBox1 .ListRows = 20 .AddItem (0.375) .AddItem (0.5) .AddItem (0.75) End With -- Dave Peterson |
Trailing Zeros
..AddItem format(0.375, "0.000")
-- HTH... Jim Thomlinson "aftamath77" wrote: I'm designing a combobox with decimal numbers. When I use .additem and type in the numbers, it drops the trailing zeros. (ie. 0.500 becomes 0.5 automatically) I need the zeros for precision and consistancy purposes. Is there a line I can include in this code? With ComboBox1 .ListRows = 20 .AddItem (0.375) .AddItem (0.5) .AddItem (0.75) End With |
Trailing Zeros
Thanks Dave. "The simplest answers..."
"Dave Peterson" wrote: Since they're text in the combobox, just add them as text: With ComboBox1 .ListRows = 20 .AddItem "0.375" .AddItem "0.500" 'or even .AddItem format(0.75,"0.000") End With aftamath77 wrote: I'm designing a combobox with decimal numbers. When I use .additem and type in the numbers, it drops the trailing zeros. (ie. 0.500 becomes 0.5 automatically) I need the zeros for precision and consistancy purposes. Is there a line I can include in this code? With ComboBox1 .ListRows = 20 .AddItem (0.375) .AddItem (0.5) .AddItem (0.75) End With -- Dave Peterson |
All times are GMT +1. The time now is 10:57 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com