Formats in Listbox?

C

CG Rosén

Good Evening,

Grateful for some hints about following;

Filling a ListBox with values from a WorkSheet with below code:
----
Item1 = Sheets(1).Cells(r, 1)
UserForm3.ListBox2.AddItem Item1
----

This is working OK, but the cells in the Sheet is formatted as numbers 1,00
0,75 0,50 etc.
When showed in the ListBox they are in text(?) format as 1 0,75 0,5.
How to make the ListBox to show all decimals as in number format?

Brgds

CG Rosén
 
G

Guest

By the way, a few useful tips on listboxes:
MultiColumn: assuming you have, say, 3 columns of data in sheet1 in a sheet-level named range called Data (data not including the header row)
With Listbox1
.columncount = 3 'set listbox to 3 columns
'= Range("sheet1!data").Columns.count
.RowSource="Sheet1!Data" 'set all the items automatically
'and updates is auto and bi-directional
'ie changing list value changes range and vise versa
.Columnheads=true 'create a header in the listbox = names
'in row above range Data
.Columnwidths ="100;0;100" 'sets the column width of each col (in points).
'2nd col is hiddden=0
.Columnbound=2 'sets the Value of the lisbox to be the 2nd column (use
'0 for Listitem number to be returned
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top