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
| Private Sub ComboBox1_Change()
Set Rg = Sheets("Achat").Range("C:C").Find(what:=UserForm1.ComboBox1.Text, lookat:=xlWhole)
If UserForm1.ComboBox1 = "" Then
Else
If Not Rg Is Nothing Then
strFormule1 = "SUM('Achat'!D" & Rg.Row + 5 & ":D" & Rg.Row + 7 & ")"
strFormule2 = "SUM('Achat'!D" & Rg.Row + 8 & ":D" & Rg.Row + 10 & ")"
strFormule3 = "SUM('Achat'!D" & Rg.Row + 11 & ":D" & Rg.Row + 13 & ")"
strFormule4 = "SUM('Achat'!D" & Rg.Row + 14 & ":D" & Rg.Row + 16 & ")"
Sheets("Couverture").Range("D14").Formula = "=" & strFormule1
Sheets("Couverture").Range("D17").Formula = "=" & strFormule2
Sheets("Couverture").Range("D20").Formula = "=" & strFormule3
Sheets("Couverture").Range("D23").Formula = "=" & strFormule4
strFormule5 = "SUM('Achat'!F" & Rg.Row + 5 & ":F" & Rg.Row + 7 & ")"
strFormule6 = "SUM('Achat'!F" & Rg.Row + 8 & ":F" & Rg.Row + 10 & ")"
strFormule7 = "SUM('Achat'!F" & Rg.Row + 11 & ":F" & Rg.Row + 13 & ")"
strFormule8 = "SUM('Achat'!F" & Rg.Row + 14 & ":F" & Rg.Row + 16 & ")"
Sheets("Couverture").Range("E14").Formula = "=" & strFormule5
Sheets("Couverture").Range("E17").Formula = "=" & strFormule6
Sheets("Couverture").Range("E20").Formula = "=" & strFormule7
Sheets("Couverture").Range("E23").Formula = "=" & strFormule8
Else
End If
End If
End Sub |
Partager