asyamonique
Well-known Member
- Joined
- Jan 29, 2008
- Messages
- 1,286
- Office Version
- 2013
- Platform
- Windows
Code:
Private Sub ComboBox9_Change()Application.ScreenUpdating = False
Dim a, i As Long, ii As Long, b(), n As Long
ListBox1.Clear
With ComboBox9
If .Text = "" Then Exit Sub
If WorksheetFunction.CountIf(Worksheets("taxi").Range("a:a"), .Text) = 0 Then
Exit Sub
End If
a = Worksheets("taxi").Range("a1").Resize(Worksheets("taxi").Range("a" & Rows.Count).End(xlUp).Row, 11).Value
For i = 1 To UBound(a, 1)
If a(i, 1) = .Text Then
n = n + 1: ReDim Preserve b(1 To 11, 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-yyyy")
b(4, n) = Format$(a(i, 4), "h:mm")
End If
Next
End With
With ListBox1
.ColumnCount = 11
.ColumnWidths = "0;60;80;50;160;160;120;100;100;60;0"
.Column = b
End With
With Application
Me.TextBox18.Value = .Count(.Index(b, 9, 0)) & " Entries"
Me.TextBox16.Value = .Sum(.Index(b, 10, 0))
TextBox16.Text = Format(TextBox16.Text, "###,##0.00") & " Usd"
End With
Application.ScreenUpdating = True
End Sub
Good Day,
I would like to ask you a question in regards filtering the datas by two comboboxes in the same worksheet.
The code given above give me the results by one comboxes correctly everything is fine with that.
Onto the userform I've placed another combobox named combobox11 with the related datas by column "B"
Is it possible to filter all the datas when I do combobox11 change; from column A (by combobox9) and column B (by combobox11)?
And also textbox16 and 18 will give me the related sum results.
Many Thanks