![]() |
Reformatting data for a listbox
I'm filling a listbox on a userform with an array linked to a Range and the
data displays in long decimal format. I want it displayed to only two decimal places. The Range itself display correctly, but the cells contain formulas, not values. The "numberformat" property doen't seem to apply to arrays or listboxes. Is there a method I can use to properly display the data in the listbox without going through the step of recopying/formatting the Range as values and then filling the array (and subsequently the list box)? This is a fake example but it gets the point across: - Range("a1") =(some big honking formula that = 2.009873654) but displays as "2" - MyArray (0,0) = Range("a1") - Listbox1.list = MyArray (and displays as 2.009873654...) |
Reformatting data for a listbox
Try MyArray(0,0) = Format(Range("A1"),"0.##")
-- Charles Chickering "A good example is twice the value of good advice." "BG" wrote: I'm filling a listbox on a userform with an array linked to a Range and the data displays in long decimal format. I want it displayed to only two decimal places. The Range itself display correctly, but the cells contain formulas, not values. The "numberformat" property doen't seem to apply to arrays or listboxes. Is there a method I can use to properly display the data in the listbox without going through the step of recopying/formatting the Range as values and then filling the array (and subsequently the list box)? This is a fake example but it gets the point across: - Range("a1") =(some big honking formula that = 2.009873654) but displays as "2" - MyArray (0,0) = Range("a1") - Listbox1.list = MyArray (and displays as 2.009873654...) |
All times are GMT +1. The time now is 07:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com