PDA

View Full Version : Solved: Listbox Index - Number format



jmaocubo
12-13-2011, 05:23 PM
Hi

I have a userform with a listbox that lists all the values of two columns.
I am using the following code:


Dim Rng As Range
Set Rng = Range(Sheets("Auxiliar").Range("A1"), Sheets("Auxiliar").Range("A" & rows.Count).End(xlUp)).Resize(, 5)

With ListBox1
.ColumnCount = 2
.ColumnWidths = "50,30"
.List = Application.Index(Rng, Evaluate("row(" & Rng.Address & ") "), Array(1, 5))
End With


It turns out that when for example cell A1 = 0.83333333(3) I need that only appear in the listbox 0.83 and if for example cell A1 = 0.8354643 then 0.84 appear in the listbox.

How can I do this?

Thanks in advance

Miguel

GTO
12-13-2011, 07:45 PM
Try:
.List = Application.Round(Application.Index(Rng, Evaluate("row(" & Rng.Address(0, 0, , -1) & ") "), Array(1, 5)), 2)