Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Converting decimal number to hh:mm format | Excel Discussion (Misc queries) | |||
Format for Whole number and 1 Decimal in same Cell | Excel Worksheet Functions | |||
Number format still uses decimal point | New Users to Excel | |||
Number format for Combobox | Excel Discussion (Misc queries) | |||
Number format and decimal positions | Excel Programming |