MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Listbox Number Format


Posted by John on December 28, 2001 8:31 AM

I have had difficulty in VBA to control the number format of a listbox. I currently have code that adds items from calculated cells. The cell format shows the number to the second decimal place (ie 0.00), but the listbox will give the entire calculated number (ie 0.00000000000000000). How do you format the listbox to control the decimal places?


Posted by Mike on December 28, 2001 9:03 AM

You could format the data when you add it to the list box:

ListBox1.AddItem Format(mydata, "###0.00")

-Mike

Posted by Mike on December 28, 2001 9:03 AM

You could format the data when you add it to the list box:

ListBox1.AddItem Format(mydata, "###0.00")

-Mike