Sub LOC(DateDebut As Date, DateFin As Date, Prescripteur As String)
Dim F As Worksheet
Dim LR As Long
Dim L As Range
Dim i As Integer, LIGNE As Integer
Set F = ThisWorkbook.Sheets("GIAO DICH")
LR = F.Range("A" & Rows.Count).End(xlUp).Row
With Me.XUANCHIEN
If Me.LNGAY <> "" And Me.LNGAY1 <> "" And Me.MALK = "" Then
.ListItems.Clear
.View = lvwReport
.FullRowSelect = True
If LR = 2 Then Exit Sub
LIGNE = 1
For Each L In F.Range("B4:B" & LR)
If CDate(L) >= DateDebut And CDate(L) <= DateFin Then
.ListItems.Add , , L
For i = 1 To 7
.ListItems(LIGNE).ListSubItems.Add , , UNItoTCVN3(L.Offset(, i - 1))
Next i
LIGNE = LIGNE + 1
End If
Next L
End If
Set F = Nothing
Set F = ThisWorkbook.Sheets("GIAO DICH")
LR = F.Range("A" & Rows.Count).End(xlUp).Row
If Me.LNGAY <> "" And Me.LNGAY1 <> "" And Me.MALK <> "" Then
.ListItems.Clear
.View = lvwReport
.FullRowSelect = True
If LR = 2 Then Exit Sub
LIGNE = 1
For Each L In F.Range("B4:B" & LR)
If CDate(L) >= DateDebut And CDate(L) <= DateFin And CStr(L.Offset(, 2)) = Prescripteur Then
.ListItems.Add , , L.Offset(, -1).Value '.ListItems.Add , , L
For i = 1 To 7
.ListItems(LIGNE).ListSubItems.Add , , UNItoTCVN3(L.Offset(, i - 1))
Next i
LIGNE = LIGNE + 1
End If
Next L
End If
End With
Set F = Nothing
Dim Item As ListItem
For Each Item In XUANCHIEN.ListItems()
Item.SubItems(1) = Format(Item.ListSubItems(1), "[$-409]d-mmm-yyyy;@")
Next Item
End Sub