Private Sub ListBox1_Click()
Dim i
i = ListBox1.ListIndex
Range("E6") = Sheet1.ListBox1.List(i, 0)
Range("E7") = Sheet1.ListBox1.List(i, 1)
Range("E7").Activate
Hide
End Sub
Private Sub thaydoi()
With Sheet1.TextBox1
.Visible = False
.Visible = True
.Left = ActiveCell.Left
.Top = ActiveCell.Top
.Width = ActiveCell.Width
.Height = ActiveCell.Height
.Value = ""
.Activate
End With
With Sheet1.ListBox1
.Visible = False
.Visible = True
.ColumnCount = 2
.Left = ActiveCell.Offset(, 1).Left
.Width = ActiveCell.Width * 1.5
.Height = 150
.Top = ActiveCell.Offset(, 1).Top
.Clear
End With
End Sub
Private Sub loc()
Dim sArr(), Arr(), Res(), i As Long, k As Long, tmp As String, maHang As String
With Sheet2
sArr = .Range("M6:N74").Value
End With
ReDim Arr(0 To UBound(sArr), 1 To 2)
Sheet1.ListBox1.Clear
tmp = UCase(TV(Sheet1.TextBox1.Value))
For i = 1 To UBound(sArr)
maHang = sArr(i, 1)
If maHang <> "" Then
If UCase(TV(maHang)) Like "*" & tmp & "*" Then
Arr(k, 1) = maHang
Arr(k, 2) = sArr(i, 2)
k = k + 1
End If
End If
Next
ReDim Res(0 To k, 1 To 2)
For i = 0 To k
Res(i, 1) = Arr(i, 1): Res(i, 2) = Arr(i, 2)
Next i
Sheet1.ListBox1.List = Res
End Sub