Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Decimal Number Format in ComboBox

Hello,

I am working on a project where I am defining the content of Combo
Boxes with the code below from the "UserForm Initialize" command:

For v = 13 To 16
ComboBox1.AddItem Worksheets("Worksheet1").Cells(v, 9).Value
Next v

This fills the data nicely in the combo boxes.

However, I am stuck with number decimal formatting. Let's say I want
all of the numbers in the ComboBox to have 3 decimal places of
accuracy, even if it lists xx.000. Does anybody have any code ideas to
work with the current code I have?

I appreciate any feedback!! :)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 394
Default Decimal Number Format in ComboBox

Hi Drummer361,

Try something like :-

NumberFormat = "0.000"

Hope this Helps.
All the Best.
Paul

Drummer361 wrote:
Hello,

I am working on a project where I am defining the content of Combo
Boxes with the code below from the "UserForm Initialize" command:

For v = 13 To 16
ComboBox1.AddItem Worksheets("Worksheet1").Cells(v, 9).Value
Next v

This fills the data nicely in the combo boxes.

However, I am stuck with number decimal formatting. Let's say I want
all of the numbers in the ComboBox to have 3 decimal places of
accuracy, even if it lists xx.000. Does anybody have any code ideas to
work with the current code I have?

I appreciate any feedback!! :)


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Decimal Number Format in ComboBox

Hi Paul, thanks for the quick response!

I just got it to partially work! Here is how I implemented the code:

For v = 13 To 16
ComboBox1.AddItem Format((Worksheets("Worksheet1").Cells(v,
9).Value), "0.000")
Next v

My issue now is that the initial number that displays before you click
on the ComboBox drop-down list isn't formatted. I must be overlooking
something on the UserForm Initialize command? It's formatted in the
Excel worksheet, and after I select a new value in the drop-down the
number I choose is formatted fine. Just the value on form load remains
without any decimal formatting.... any suggestions?

Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Decimal Number Format in ComboBox

I figured it out!

Here is the code that runs from a module called in the
UserForm_Initialize command:

formUserForm1.ComboBox1.Value = Format(formUserForm1.ComboBox1.Value,
"#.000")


Drummer361 wrote:
Hi Paul, thanks for the quick response!

I just got it to partially work! Here is how I implemented the code:

For v = 13 To 16
ComboBox1.AddItem Format((Worksheets("Worksheet1").Cells(v,
9).Value), "0.000")
Next v

My issue now is that the initial number that displays before you click
on the ComboBox drop-down list isn't formatted. I must be overlooking
something on the UserForm Initialize command? It's formatted in the
Excel worksheet, and after I select a new value in the drop-down the
number I choose is formatted fine. Just the value on form load remains
without any decimal formatting.... any suggestions?

Thanks!


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
Converting decimal number to hh:mm format Jeff Lowenstein Excel Discussion (Misc queries) 2 April 15th 08 08:39 PM
Format for Whole number and 1 Decimal in same Cell Sean Excel Worksheet Functions 4 November 30th 07 01:44 PM
Number format still uses decimal point BecknRoos New Users to Excel 3 April 9th 07 06:32 AM
Number format for Combobox MBlake Excel Discussion (Misc queries) 1 June 29th 05 03:25 AM
Number format and decimal positions Neal Zimm Excel Programming 3 April 30th 05 02:29 AM


All times are GMT +1. The time now is 04:54 PM.

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"