How to format ListBox columns

D

donwb

How can I format a Listbox column containing numbers to include
2 decimal points including zeros and thousands separators-
eg the source data is formatted to read 1,234.20 but
this is reproduced in the ListBox column as 1234.2 and
1,234.00 as just 1234
Also , how can I set the width of a column containing text
to fit the widest entry.
Any help would be appreciated.
donwb
 
K

Kassie

Select the list cell, click on Format Cells, Number, tick Use Thousands
seperator, and allow 2 decimals.

To fir for widest entry, move cursor to the column heading. If you want to
eg adjust column G, move your cursor to the line between G and H. It will
change shape to a vertical line with horizontal arrows. Double click and
you're done.
 
D

donwb

Hi Kassie,
Thanks for your reply.
Perhaps I wasn't very clear in my question,
but the column I'm referring to is a column in a ListBox,
so the formatting needs to be done via VBA code,
or via the settings for the ListBox.
Also the same applies to the ListBox column width
fitting the widest entry.
donwb
 
K

Kassie

Sorry, my mistake! Normally I set list box properties in the VBA properties
window. It is my experience that if the source list is formatted a specific
way, that the listbox adopts this formatting. Column widths are also set in
the properties window. There is an option Column widths, which accept
measurements in points. Enter your desired column widths here, seperated by
a ;. I do not know how to set it at runtime though.

--

HTH

Kassie

Replace xxx with hotmail
 

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

Top