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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
Option Compare Text
Sub Liste_Fournisseur()
Application.ScreenUpdating = False
Set f1 = Sheets("CALCUL")
Set f2 = Sheets("Liste produits")
'Création liste des fournisseurs
Support = f1.[C7]
f1.Columns("L:O").ClearContents
f1.[C8:C12].ClearContents
Dl_F2 = f2.[A100].End(xlUp).Row
L = 1
For i = 2 To Dl_F2
If f2.Cells(i, "A") = Support Then
If L = 1 Then
f1.Cells(L, "L") = f2.Cells(i, "D")
L = L + 1
ElseIf L > 1 And f2.Cells(i, "D") <> f1.Cells(L - 1, "L") Then
f1.Cells(L, "L") = f2.Cells(i, "D")
L = L + 1
End If
End If
Next i
DL = f1.[L100].End(xlUp).Row
f1.Range("L1:L" & DL).Sort [L1], 1
f1.Names.Add Name:="Liste1", RefersToR1C1:="=CALCUL!R1C12:R" & DL & "C12"
f1.Range("C8").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=Liste1"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Set f1 = Nothing
Set f2 = Nothing
End Sub
Sub Liste_Matiere()
Application.ScreenUpdating = False
Set f1 = Sheets("CALCUL")
Set f2 = Sheets("Liste produits")
'Création liste des matières
Support = f1.[C7]
Fournisseur = f1.[C8]
f1.Columns("M:O").ClearContents
f1.[C9:C12].ClearContents
Dl_F2 = f2.[A100].End(xlUp).Row
L = 1
For i = 2 To Dl_F2
If f2.Cells(i, "A") = Support And f2.Cells(i, "D") = Fournisseur Then
If L = 1 Then
f1.Cells(L, "M") = f2.Cells(i, "J")
L = L + 1
ElseIf L > 1 And f2.Cells(i, "J") <> f1.Cells(L - 1, "M") Then
f1.Cells(L, "M") = f2.Cells(i, "J")
L = L + 1
End If
End If
Next i
DL = f1.[M100].End(xlUp).Row
f1.Range("M1:M" & DL).Sort [M1], 1
f1.Names.Add Name:="Liste2", RefersToR1C1:="=CALCUL!R1C13:R" & DL & "C13"
f1.Range("C9").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=Liste2"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Set f1 = Nothing
Set f2 = Nothing
End Sub
Sub Liste_Format()
Application.ScreenUpdating = False
Set f1 = Sheets("CALCUL")
Set f2 = Sheets("Liste produits")
'Création liste des formats
Support = f1.[C7]
Fournisseur = f1.[C8]
Matiere = f1.[C9]
f1.Columns("N:O").ClearContents
f1.[C10:C12].ClearContents
Dl_F2 = f2.[A100].End(xlUp).Row
L = 1
For i = 2 To Dl_F2
If f2.Cells(i, "A") = Support And f2.Cells(i, "D") = Fournisseur And f2.Cells(i, "J") = Matiere Then
If L = 1 Then
f1.Cells(L, "N") = f2.Cells(i, "G")
L = L + 1
ElseIf L > 1 And f2.Cells(i, "G") <> f1.Cells(L - 1, "N") Then
f1.Cells(L, "N") = f2.Cells(i, "G")
L = L + 1
End If
End If
Next i
DL = f1.[N100].End(xlUp).Row
f1.Range("N1:N" & DL).Sort [N1], 1
f1.Names.Add Name:="Liste3", RefersToR1C1:="=CALCUL!R1C14:R" & DL & "C14"
f1.Range("C10").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=Liste3"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Set f1 = Nothing
Set f2 = Nothing
End Sub
Sub Liste_Epaisseur()
Application.ScreenUpdating = False
Set f1 = Sheets("CALCUL")
Set f2 = Sheets("Liste produits")
'Création liste des épaisseurs
Support = f1.[C7]
Fournisseur = f1.[C8]
Matiere = f1.[C9]
Formats = f1.[C10]
f1.Columns("O:O").ClearContents
f1.[C11:C12].ClearContents
Dl_F2 = f2.[A100].End(xlUp).Row
L = 1
For i = 2 To Dl_F2
If f2.Cells(i, "A") = Support And f2.Cells(i, "D") = Fournisseur And f2.Cells(i, "J") = Matiere And f2.Cells(i, "G") = Formats Then
If L = 1 Then
f1.Cells(L, "O") = f2.Cells(i, "M")
L = L + 1
ElseIf L > 1 And f2.Cells(i, "M") <> f1.Cells(L - 1, "O") Then
f1.Cells(L, "O") = f2.Cells(i, "M")
L = L + 1
End If
End If
Next i
DL = f1.[O100].End(xlUp).Row
f1.Range("O1:O" & DL).Sort [O1], 1
f1.Names.Add Name:="Liste4", RefersToR1C1:="=CALCUL!R1C15:R" & DL & "C15"
f1.Range("C11").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=Liste4"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
'Formule du prix de vente
f1.Range("C12").FormulaR1C1 = "=SUMPRODUCT(('Liste produits'!R[-10]C[-2]:R[1]C[-2]=R7C3)*('Liste produits'!R[-10]C[1]:R[1]C[1]=R8C3)*('Liste produits'!R[-10]C[7]:R[1]C[7]=R9C3)*('Liste produits'!R[-10]C[4]:R[1]C[4]=R10C3)*('Liste produits'!R[-10]C[10]:R[1]C[10]=R11C3),'Liste produits'!R[-10]C[13]:R[1]C[13])"
Set f1 = Nothing
Set f2 = Nothing
End Sub |
Partager