ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   TextAlign in List Box (https://www.excelbanter.com/excel-programming/427989-textalign-list-box.html)

kirkm[_8_]

TextAlign in List Box
 
I have a multi column list box and it's row source assigned to a
worksheet. Three of the columns contain numbers which should be
right aligned, and three text, to be left aligned.

The TextAlign properties affects all columns.

Is there any way to achieve this? I can get the Worksheet
formatted perfectly but that's lost in the list box.

Any help much appreciated

Thanks - Kirk

kirkm[_8_]

TextAlign in List Box
 

I'm answering my own question!

Just in case anyone's interested... or has an improvement.

Set TextAlign to 3. This fixes the numbers

For left alignment this works for me -

Function fixedlength(theString)
fixedlength = Left(theString & String$(10, 9), 10 + Len(theString))
End Function

ActiveWorkbook.Worksheets("Sheet1"t).Range("A1").V alue =
LTrim(fixedlength("12345"))


All times are GMT +1. The time now is 04:47 PM.

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