1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
Private Sub CmbRecherche_Click()
Dim Cell As Range
Dim TAB1(0 To 50, 0 To 6) As String
Dim I As Byte
Dim L As Byte
If CmbDate.Value = "" And CmbNum.Value = "" And CmbTiers = "" And CmbEngagt = "" Then
MsgBox "Veuillez faire un choix de recherche", vbInformation + vbOKOnly, "Avertissement..."
LstResult.Clear
Exit Sub
End If
If CmbDate.Value <> "" Then
L = Len(CmbDate)
For Each Cell In Sheets("Facture").Range("IntituDate")
If UCase(Left(Cell.Text, L)) = UCase(CmbDate.Text) Then
TAB1(I, 0) = Cell.Offset(0, -1).Text
TAB1(I, 1) = Cell.Text
TAB1(I, 2) = Cell.Offset(0, -7).Text
TAB1(I, 3) = Cell.Offset(0, -14).Text
TAB1(I, 4) = Cell.Offset(0, 2).Text
TAB1(I, 5) = Cell.Offset(0, 5).Text
I = I + 1
End If
Next
LstResult.ColumnCount = 6
LstResult.ColumnWidths = "1,5cm" & ";" & "2cm" & ";" & "6cm" & ";" & "3cm" & ";" & "3cm" & ";" & "3cm"
LstResult.List = TAB1()
ElseIf CmbNum.Value <> "" Then
L = Len(CmbNum)
For Each Cell In Sheets("Facture").Range("IntituFact")
If UCase(Left(Cell.Text, L)) = UCase(CmbNum.Text) Then
TAB1(I, 0) = Cell.Text
TAB1(I, 1) = Cell.Offset(0, 1).Text
TAB1(I, 2) = Cell.Offset(0, -6).Text
TAB1(I, 3) = Cell.Offset(0, -13).Text
TAB1(I, 4) = Cell.Offset(0, 3).Text
TAB1(I, 5) = Cell.Offset(0, 6).Text
I = I + 1
End If
Next
ElseIf CmbTiers.Value <> "" Then
L = Len(CmbTiers)
For Each Cell In Sheets("Facture").Range("IntituEnt")
If UCase(Left(Cell.Text, L)) = UCase(CmbTiers.Text) Then
TAB1(I, 0) = Cell.Offset(0, 6).Text
TAB1(I, 1) = Cell.Offset(0, 7).Text
TAB1(I, 2) = Cell.Text
TAB1(I, 3) = Cell.Offset(0, -7).Text
TAB1(I, 4) = Cell.Offset(0, 9).Text
TAB1(I, 5) = Cell.Offset(0, 12).Text
I = I + 1
End If
Next
LstResult.ColumnCount = 6
LstResult.ColumnWidths = "1,5cm" & ";" & "2cm" & ";" & "6cm" & ";" & "3cm" & ";" & "3cm" & ";" & "3cm"
LstResult.List = TAB1()
ElseIf CmbEngagt.Value <> "" Then
L = Len(CmbEngagt)
For Each Cell In Sheets("Facture").Range("IntituEngt")
If UCase(Left(Cell.Text, L)) = UCase(CmbEngagt.Text) Then
TAB1(I, 0) = Cell.Offset(0, 13).Text
TAB1(I, 1) = Cell.Offset(0, 14).Text
TAB1(I, 2) = Cell.Offset(0, 7).Text
TAB1(I, 3) = Cell.Text
TAB1(I, 4) = Cell.Offset(0, 16).Text
TAB1(I, 5) = Cell.Offset(0, 19).Text
I = I + 1
End If
Next
LstResult.ColumnCount = 6
LstResult.ColumnWidths = "1,5cm" & ";" & "2cm" & ";" & "6cm" & ";" & "3cm" & ";" & "3cm" & ";" & "3cm"
LstResult.List = TAB1()
End If
LstResult.ColumnCount = 6
LstResult.ColumnWidths = "1,5cm" & ";" & "2cm" & ";" & "6cm" & ";" & "3cm" & ";" & "3cm" & ";" & "3cm"
LstResult.List = TAB1()
End Sub |
Partager