ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   multicolumn Listbox and textalignment (https://www.excelbanter.com/excel-programming/276375-multicolumn-listbox-textalignment.html)

Chip Pearson

multicolumn Listbox and textalignment
 
John,

I don't believe it is possible to change the alignments of individual
columns of a listbox.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"John Holland" wrote in message
...
Would there be a way to independently assign textalignments to different
columns in a multicolumn Listbox on a Userform ? Thanks,
JH





John Holland

multicolumn Listbox and textalignment
 
Would there be a way to independently assign textalignments to different
columns in a multicolumn Listbox on a Userform ? Thanks,
JH



Stephen Bullen

multicolumn Listbox and textalignment
 
Hi John,

i had that feeling. For an application in which i need to right align a
currency and in the same list have other columns align left, i need some
kind of tric. i tried formatting the column in the Excel-sheet itself in a
variety of ways, but i cannot get it as it should. I was thinking of having
the currency formats read into a textstring with a certain length and lead
them with enough blanks to have them aligned right as well. Do you think
that would work, or would i have a better chance by filling the Listbox
using an array in stead of using the Cellrange of a sheet ? Thanks for any
comments,


An alternative would be to use the common ListView control instead of the
built-in ListBox. It's a little harder to code against, but gives much more
functionality (including alignment of individual columns). You can add it by
right-clicking the control toolbox, choosing 'Additional controls' and
selecting the 'Microsoft List View control'.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.co.uk


John Holland

multicolumn Listbox and textalignment
 
thanks for your suggestion Stephen, i have not tried it yet, because in the
meantime i have been able to accomplish what i wanted by adjusting the
formatting of the input data. it required some trial and error, but finally
managed to have a currency align on the right in a Listbox, while the
original and all other columns are outlined on the left,
thanks again,
JH

"Stephen Bullen" wrote in message
...
Hi John,

i had that feeling. For an application in which i need to right align a
currency and in the same list have other columns align left, i need some
kind of tric. i tried formatting the column in the Excel-sheet itself in

a
variety of ways, but i cannot get it as it should. I was thinking of

having
the currency formats read into a textstring with a certain length and

lead
them with enough blanks to have them aligned right as well. Do you think
that would work, or would i have a better chance by filling the Listbox
using an array in stead of using the Cellrange of a sheet ? Thanks for

any
comments,


An alternative would be to use the common ListView control instead of the
built-in ListBox. It's a little harder to code against, but gives much

more
functionality (including alignment of individual columns). You can add it

by
right-clicking the control toolbox, choosing 'Additional controls' and
selecting the 'Microsoft List View control'.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.co.uk





All times are GMT +1. The time now is 12:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com