hatinh10101991
Thành viên mới
- Tham gia
- 12/5/21
- Bài viết
- 4
- Được thích
- 0
Sub TextBox3_Change()
Dim LastRow As Long
Dim i As Long
Dim y As Long
Dim StringLenght As Long
LastRow = Sheets("BANHANG").Cells(Rows.Count, 3).End(xlUp).Row
StringLenght = Me.TextBox3.TextLength
With Me.ListBox1
.Clear
End With
For i = 16 To LastRow
For y = 1 To Len(Sheets("BANHANG").Cells(i, 3))
If LCase(Mid(Sheets("BANHANG").Cells(i, 3), y, StringLenght)) = TextBox3.Text And TextBox3.Text <> "" Then
With Me.ListBox1
.AddItem Sheets("BANHANG").Cells(i, 2)
.List(ListBox1.ListCount - 1, 1) = Sheets("BANHANG").Cells(i, 3)
.List(ListBox1.ListCount - 1, 2) = Sheets("BANHANG").Cells(i, 4)
End With
End If
Next y
Next i
End Sub
mình lấy textbox3 để tra để cho hiện thị lên listbox1 mà lỗi type match
Dim LastRow As Long
Dim i As Long
Dim y As Long
Dim StringLenght As Long
LastRow = Sheets("BANHANG").Cells(Rows.Count, 3).End(xlUp).Row
StringLenght = Me.TextBox3.TextLength
With Me.ListBox1
.Clear
End With
For i = 16 To LastRow
For y = 1 To Len(Sheets("BANHANG").Cells(i, 3))
If LCase(Mid(Sheets("BANHANG").Cells(i, 3), y, StringLenght)) = TextBox3.Text And TextBox3.Text <> "" Then
With Me.ListBox1
.AddItem Sheets("BANHANG").Cells(i, 2)
.List(ListBox1.ListCount - 1, 1) = Sheets("BANHANG").Cells(i, 3)
.List(ListBox1.ListCount - 1, 2) = Sheets("BANHANG").Cells(i, 4)
End With
End If
Next y
Next i
End Sub
mình lấy textbox3 để tra để cho hiện thị lên listbox1 mà lỗi type match