Ở đây em dùng Combobox Form Control chứ ko phải ActiveX Control. Và cho em hỏi luôn là có cách nào dùng Combobox để liệt kê dữ liệu từ Sheet khác mà ko dùng Macro hay VBA ko ạ. Em đã viết 1 cái Macro để liệt kê dữ liệu mỗi khi chọn 1 giá trị từ Combobox Mã NV như sau:
Anh chị nào có thể sửa lỗi sai trong Macro này giúp em đc ko ạ. Em xin cảm ơn nhiều.
PHP:
Sub ChonNV()
Dim manv As Integer
Dim sohd As String
Dim masp As Integer
Dim soluong As Long
Dim Row As Long
Dim Found As Boolean
manv = Range("A4").Value
Sheets("ChiTietHD").Select
Found = False
Row = 2
Do While Found = False
If Range("J" & Row).Value = manv Then
Found = True
sohd = Range("A" & Row).Value
masp = Range("B" & Row).Value
soluong = Range("C" & Row).Value
Sheets("ThongKe").Select
Range("J" & Row).Value = sohd
Range("K" & Row).Value = masp
Range("L" & Row).Value = soluong
ElseIf IsEmpty(Range("J" & Row).Value) = True Then
MsgBox ("Khong tim thay.")
Exit Sub
End If
Row = Row + 1
Loop
End Sub
Anh chị nào có thể sửa lỗi sai trong Macro này giúp em đc ko ạ. Em xin cảm ơn nhiều.
File đính kèm
Lần chỉnh sửa cuối: