drom
Well-known Member
- Joined
- Mar 20, 2005
- Messages
- 543
- Office Version
- 2021
- 2019
- 2016
- 2013
- 2011
- 2010
- 2007
Hi and Thanks in advane!
I have a ListoBox from the "ActiveX Controls" attached to the range: range("D2:E4")
The listFillRange of this ListBox is a dinamic range with 4 columns, "columns are always 4" rows is dinamic.
in this ListBox I am showing the 2nd and the 4th Column of my dinamic range named "rPT"
so ColumnCount = 4
now I would like to fix the ColumnWidths.
At present I have got this done this way:
ColumnWidths=0 pt;75 pt;0 pt;175 pt
I would like to do this by VBA and my code works fine but the ListBox does not apply the changes to the Width...
I mean If I do:
I can see on the ListBox properties that the columnsWidth are OK, but the listBox does not apply those changes to the ListBox, I know this because if I change manually the Columns("C:C") width to 200 and then I click on the listBox, the ListBox still equal.
But the debug.print ListBox1.ColumnWidths CHANGES
I have a ListoBox from the "ActiveX Controls" attached to the range: range("D2:E4")
The listFillRange of this ListBox is a dinamic range with 4 columns, "columns are always 4" rows is dinamic.
in this ListBox I am showing the 2nd and the 4th Column of my dinamic range named "rPT"
so ColumnCount = 4
now I would like to fix the ColumnWidths.
At present I have got this done this way:
ColumnWidths=0 pt;75 pt;0 pt;175 pt
I would like to do this by VBA and my code works fine but the ListBox does not apply the changes to the Width...
I mean If I do:
Code:
Private Sub ListBox1_Click()
Dim rPT As Range: Set rPT = Range("$C$5:$D$5")
Dim xx As Long: xx = rPT.Cells(1).Width
Dim yy As Long: yy = rPT.Cells(2).Width
ListBox1.ColumnCount = 4
ListBox1.ColumnWidths = "0;" & xx & ";0;" & yy
End Sub
I can see on the ListBox properties that the columnsWidth are OK, but the listBox does not apply those changes to the ListBox, I know this because if I change manually the Columns("C:C") width to 200 and then I click on the listBox, the ListBox still equal.
But the debug.print ListBox1.ColumnWidths CHANGES