#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 30
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 30
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I force trailing zeros in an Excel cell? Tony C New Users to Excel 9 April 5th 23 01:06 PM
forcing trailing zeros on 5-digit Zip dandiehl Excel Discussion (Misc queries) 4 December 12th 09 10:52 PM
Keep numbers as entered with trailing zeros Allie Excel Discussion (Misc queries) 2 August 3rd 06 06:39 PM
Keep Trailing Zeros When Convert To Text Todd G Excel Discussion (Misc queries) 2 March 23rd 06 03:16 PM
Formula/formatting to omit trailing zeros Robin Excel Worksheet Functions 5 March 22nd 06 06:29 AM


All times are GMT +1. The time now is 10:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"