Rùa Con 1080
Thành Viên Sao Chép 2
- Tham gia
- 4/5/16
- Bài viết
- 351
- Được thích
- 47
- Giới tính
- Nữ
Em có đoạn code sưu tầm trên DD, trong code chỉ tìm theo cột thứ nhất của mảng ArrChungLoai.
Bây giờ em mong mọi người giúp em chỉnh code để tìm theo cột thứ 2, mong các AC giúp đỡ
code mảng chủng loại
Bây giờ em mong mọi người giúp em chỉnh code để tìm theo cột thứ 2, mong các AC giúp đỡ
Mã:
Private Sub TimKiem()
Dim GetRows()
Dim strType As String
Dim n As Long, r As Long
strType = UCase(TextBox1) & "*"
If Trim(TextBox1) = "" Then
ListBox1.Clear
Else
' xoa ket qua cu
ListBox1.Clear
For r = 1 To UBound(Arrchungloai, 1)
If UCase(Arrchungloai(r, 1)) Like strType Then
n = n + 1
ReDim Preserve GetRows(1 To n)
GetRows(n) = r + 1
End If
Next
If n Then
Dim ArrFilter(), c As Byte
ReDim ArrFilter(1 To n, 1 To UBound(Arrchungloai, 2))
For r = 1 To n
For c = 1 To UBound(Arrchungloai, 2)
ArrFilter(r, c) = Arrchungloai(GetRows(r), c)
Next
Next
' nhap ket qua moi
ListBox1.List = ArrFilter
End If
End If
End Sub
Mã:
Arrchungloai = .Range(.Range("A65000").End(xlUp), .Range("C2")).Value