asyamonique
Well-known Member
- Joined
- Jan 29, 2008
- Messages
- 1,286
- Office Version
- 2013
- Platform
- 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,
How can i populate the column1 values from given code above into the textboxes in order from textbox1 to textbox20 on my userform while the listbox change event?
Many thanks