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
| Option Compare Text
Dim x As Range, y As Range
Dim Lig As Long
Sub Bouton_Ajouter_un_Process()
Application.ScreenUpdating = False
Set x = Columns(1).Find("Sous Total 2")
If Not x Is Nothing Then
Range(Cells(x.Row, "A"), Cells(x.Row, "G")).Insert Shift:=xlDown
Range(Cells(x.Row - 1, "B"), Cells(x.Row - 1, "D")).MergeCells = True
Range(Cells(x.Row - 1, "E"), Cells(x.Row - 1, "G")).MergeCells = True
End If
Cells(x.Row, "E").FormulaR1C1 = "=IFERROR(SUM(R14C:R" & x.Row - 1 & "C),"""")"
End Sub
Sub Bouton_Supprimer_un_Process()
Application.ScreenUpdating = False
Set x = Columns(1).Find("Sous Total 2")
If Not x Is Nothing And x.Row > 14 Then
Range(Cells(x.Row - 1, "A"), Cells(x.Row - 1, "G")).Delete Shift:=xlUp
Lig = x.Row
If Lig > 14 Then Cells(Lig, "E").FormulaR1C1 = "=IFERROR(SUM(R14C5:R" & Lig - 1 & "C5),"""")"
End If
End Sub
Sub Bouton_Ajouter_un_Outillage()
Application.ScreenUpdating = False
Set y = Columns(1).Find("Type", lookat:=xlWhole)
Set x = Columns(1).Find("Sous Total 3")
If Not x Is Nothing Then
Range(Cells(x.Row, "A"), Cells(x.Row, "G")).Insert Shift:=xlDown
Range(Cells(x.Row - 1, "B"), Cells(x.Row - 1, "D")).MergeCells = True
Range(Cells(x.Row - 1, "E"), Cells(x.Row - 1, "G")).MergeCells = True
End If
Cells(x.Row, "E").FormulaR1C1 = "=IFERROR(SUM(R" & y.Row + 1 & "C:R" & x.Row - 1 & "C),"""")"
End Sub
Sub Bouton_Supprimer_un_Outillage()
Application.ScreenUpdating = False
Set y = Columns(1).Find("Type", lookat:=xlWhole)
Set x = Columns(1).Find("Sous Total 3")
If Not x Is Nothing And x.Row > y.Row + 1 Then
Range(Cells(x.Row - 1, "A"), Cells(x.Row - 1, "G")).Delete Shift:=xlUp
Lig = x.Row
If Lig > y.Row Then Cells(Lig, "E").FormulaR1C1 = "=IFERROR(SUM(R" & y.Row + 1 & "C5:R" & Lig - 1 & "C5),"""")"
End If
End Sub |
Partager