ListBox List column freeze.

asyamonique

Well-known Member
Joined
Jan 29, 2008
Messages
1,286
Office Version
  1. 2013
Platform
  1. Windows
Code:
Private Sub ComboBox1_Change()
Dim a, i As Long, ii As Long, b(), n As Long
With ComboBox1
If .Text = "" Then Exit Sub
If WorksheetFunction.CountIf(Worksheets("info").Range("a:a"), .Text) = 0 Then
MsgBox "No Entry !"
Exit Sub
End If
a = Worksheets("info").Range("a1").Resize(Worksheets("info").Range("a" & Rows.Count).End(xlUp).Row, 25).Value
For i = 1 To UBound(a, 1)
If a(i, 1) = .Text Then
n = n + 1: ReDim Preserve b(1 To 25, 1 To n)
For ii = 1 To UBound(a, 2)
b(ii, n) = a(i, ii)
Next
End If
Next
End With
With ListBox1
.ColumnCount = 25
.ColumnWidths = "0;50;50;50;50,50;50;50;50;50;50;50;50,50;50;50;50;50;50;50;50;50,50;50;50"
.Column = b
End With
End Sub

Good Day,
The above code filter the datas and populate them into the listbox on my userform.
How can i freeze the first column while scrolling the litbox right & left?
Also is there any way to change the font color for the columns?
Many Thanks
 
Last edited:

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,224,566
Messages
6,179,553
Members
452,928
Latest member
101blockchains

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top