PDA

View Full Version : number of decimal (digits after dot) and other



grzedzik
08-26-2014, 12:12 AM
Hi, my first post

I've Got three problems that i can't handle. I'm writing a financial VBA scritpt and have to use combobox and listbox with 2 columns.

1. Combobox with 2 columns. When I unwind it I can see rows with 2 columns (e.g. person and age), but when I choose one only first column apperas in the text field of this combobox. How to display 2 (or more) columns?

2. Listbox. Cause it's financial script I have to display always two digits after period. When there are 3 or more digitis it's no problem, cause I use Round function. But when the price is eg 7.90 listbox rounds it to 7.9. I want to display 7.90. How to?

Bob Phillips
08-26-2014, 12:44 AM
1. What textbox?

2. Load it formatted, ListBox1.Additem Format(amt,"#,##0.00")

grzedzik
08-26-2014, 01:24 AM
1. The part of combobox where u can type.

2. Works great, thanks!

snb
08-26-2014, 05:50 AM
Sub tst()
sn = Sheet1.Cells(1).CurrentRegion

For j = 1 To UBound(sn)
sn(j, 1) = FormatCurrency(sn(j, 1))

'or sn(j, 1) = FormatNumber(sn(j, 1), 2)

Next

ListBox1.List = sn
End Sub