asyamonique
Well-known Member
- Joined
- Jan 29, 2008
- Messages
- 1,286
- Office Version
- 2013
- Platform
- Windows
Code:
Dim a, i As Long, ii As Long, b(), n As Long
With TextBox1
If .Text = "" Then Exit Sub
If WorksheetFunction.CountIf(Worksheets("list").Range("a:a"), .Text) = 0 Then
MsgBox "No Entry !"
Exit Sub
End If
a = Worksheets("list").Range("a1").Resize(Worksheets("list").Range("a" & Rows.Count).End(xlUp).Row, 5).Value
For i = 1 To UBound(a, 1)
If a(i, 1) = .Text Then
n = n + 1: ReDim Preserve b(1 To 5, 1 To n)
For ii = 1 To UBound(a, 2)
b(ii, n) = a(i, ii)
Next
b(3, n) = Format$(a(i, 3), "dd-mmm-yy")
End If
Next
End With
With ListBox4
.ColumnCount = 5
.ColumnWidths = "80;250;125;80;80"
.Column = b
End With
Good Day,
Is it possible to add function into given code like columns 1-2 and 2-3 will be in different color when the list box has been populated?
Many thanks