Ci-JT la macro pour laquelle tout fonctionne sauf la dernière étape qui consiste à supprimer toutes les lignes doté d'une certaine valeur
A partir de là. Ca mouline à ne plus en finir !!
Avez vous une idée ?
Merci.
a+
Sub MacroCorrigéEtSimplifié()
' Macro enregistrée
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
With Sheets("Feuil4")
For i = Range("J65536").End(xlUp).Row To 2 Step -1
If Cells(i, 10).Value = "bb" Or Cells(i, 10).Value = "cc" Or Cells(i, 10).Value = "bb" Or Cells(i, 10).Value = "ee" Or Cells(i, 10).Value = "xx" Or Cells(i, 10).Value = "tt" Or Cells(i, 10).Value = "uu" Or Cells(i, 10).Value = "nn" Or Cells(i, 10).Value = "ll" Then
Cells(i, 2).EntireRow.Delete Shift:=xlUp
End If
Next i
ActiveWindow.SmallScroll ToRight:=3
Range("R6").Select
ActiveCell.FormulaR1C1 = "=TEXT(RC[-12],0)"
Selection.AutoFill Destination:=Range("R6:R4500")
Range("R6:R4500").Select
Columns("R:R").Select
Selection.Copy
Columns("F:F").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Columns("G:G").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight
ActiveWindow.ScrollColumn = 5
ActiveWindow.SmallScroll ToRight:=2
Columns("Z:Z").Select
Selection.Copy
ActiveWindow.ScrollColumn = 1
Columns("G:G").Select
ActiveSheet.Paste
ActiveWindow.ScrollColumn = 4
ActiveWindow.SmallScroll ToRight:=10
Columns("Z:Z").Select
Selection.Copy
ActiveWindow.ScrollColumn = 1
Columns("G:G").Select
ActiveSheet.Paste
Range("G6").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1],Feuil1!R[-4]C[2]:R[2494]C[15],14,0)"
ActiveCell.FormulaR1C1 = _
"=IF(ISNA(VLOOKUP(RC[-1],Feuil1!R[-4]C[2]:R[2494]C[15],14,0)),0,VLOOKUP(RC[-1],Feuil1!R[-4]C[2]:R[2494]C[15],14,0))"
Range("G6").Select
Selection.AutoFill Destination:=Range("G6:G4500"), Type:=xlFillDefault
Range("G6:G4500").Select
ActiveWindow.ScrollRow = 1
Columns("H:H").Select
Selection.Insert Shift:=xlToRight
ActiveWindow.ScrollColumn = 5
ActiveWindow.SmallScroll ToRight:=10
Columns("Z:Z").Select
Selection.Copy
ActiveWindow.ScrollColumn = 1
Columns("H:H").Select
ActiveSheet.Paste
Range("H6").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-2],Feuil3!R[-4]C[-6]:R[2494]C[-3],4,0)"
ActiveCell.FormulaR1C1 = _
"=IF(ISNA(VLOOKUP(RC[-2],Feuil3!R[-4]C[-6]:R[2494]C[-3],4,0)),0,VLOOKUP(RC[-2],Feuil3!R[-4]C[-6]:R[2494]C[-3],4,0))"
Range("H6").Select
Selection.AutoFill Destination:=Range("H6:H4500"), Type:=xlFillDefault
Range("H6:H4500").Select
ActiveWindow.ScrollRow = 1
Columns("I:I").Select
Selection.Insert Shift:=xlToRight
ActiveWindow.ScrollColumn = 5
ActiveWindow.SmallScroll ToRight:=17
Columns("AB:AB").Select
Selection.Copy
ActiveWindow.ScrollColumn = 1
Columns("I:I").Select
ActiveSheet.Paste
Range("I6").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-3],Feuil2!R[-4]C:R[4494]C[10],11,0)"
ActiveCell.FormulaR1C1 = _
"=IF(ISNA(VLOOKUP(RC[-3],Feuil2!R[-4]C:R[4494]C[10],11,0)),0,VLOOKUP(RC[-3],Feuil2!R[-4]C:R[4494]C[10],11,0))"
Range("I6").Select
Selection.AutoFill Destination:=Range("I6:I4500"), Type:=xlFillDefault
Range("I6:I4500").Select
ActiveWindow.ScrollRow = 1
Range("V6").Select
ActiveCell.FormulaR1C1 = _
"=1*(SUMPRODUCT(1-ISNA(MATCH(RC[-4]:RC[-3],{15326366;15326550;15310554},0)))>0)"
Selection.AutoFill Destination:=Range("V6:V4500")
Range("V6:V4500").Select
Range("V6").Select
ActiveCell.FormulaR1C1 = _
"=1*(SUMPRODUCT(1-ISNA(MATCH(RC[-4]:RC[-3],{15326366;15326550;15310554},0)))>0)"
Selection.AutoFill Destination:=Range("V6:V4500")
Range("V6:V4500").Select
Range("F4").Select
ActiveCell.FormulaR1C1 = "11"
Range("G4").Select
ActiveCell.FormulaR1C1 = "22"
Range("H4").Select
ActiveCell.FormulaR1C1 = "33"
Range("I4").Select
ActiveCell.FormulaR1C1 = "44"
Range("V4").Select
ActiveCell.FormulaR1C1 = "55"
Range("W4").Select
ActiveCell.FormulaR1C1 = "66"
Range("X4").Select
ActiveCell.FormulaR1C1 = "77"
Range("Y4").Select
ActiveCell.FormulaR1C1 = "88"
Range("U4").Select
ActiveCell.FormulaR1C1 = "99"
Range("W6").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-16]>=1,1,0)"
ActiveWindow.SmallScroll ToRight:=2
Selection.AutoFill Destination:=Range("W6:W4500")
Range("W6:W4500").Select
Range("X6").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-16]>=1,1,0)"
Range("X6").Select
Selection.AutoFill Destination:=Range("X6:X4500")
Range("X6:X4500").Select
Range("Y6").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-19],Feuil3!R[-4]C[-23]:R[2494]C[-15],9,0)"
ActiveCell.FormulaR1C1 = _
"=IF(ISNA(VLOOKUP(RC[-19],Feuil3!R[-4]C[-23]:R[2494]C[-15],9,0)),0,VLOOKUP(RC[-19],Feuil3!R[-4]C[-23]:R[2494]C[-15],9,0))"
Range("Y6").Select
Selection.AutoFill Destination:=Range("Y6:Y4500")
Range("Y6:Y4500").Select
With Sheets("Feuil4") à partir de là, ça mouline !!!!
For i = Range("U65536").End(xlUp).Row To 2 Step -1
If Cells(i, 21).Value = "0" Then
Cells(i, 2).EntireRow.Delete Shift:=xlUp
End With
End Sub
A partir de là. Ca mouline à ne plus en finir !!
Avez vous une idée ?
Merci.
a+
Sub MacroCorrigéEtSimplifié()
' Macro enregistrée
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
With Sheets("Feuil4")
For i = Range("J65536").End(xlUp).Row To 2 Step -1
If Cells(i, 10).Value = "bb" Or Cells(i, 10).Value = "cc" Or Cells(i, 10).Value = "bb" Or Cells(i, 10).Value = "ee" Or Cells(i, 10).Value = "xx" Or Cells(i, 10).Value = "tt" Or Cells(i, 10).Value = "uu" Or Cells(i, 10).Value = "nn" Or Cells(i, 10).Value = "ll" Then
Cells(i, 2).EntireRow.Delete Shift:=xlUp
End If
Next i
ActiveWindow.SmallScroll ToRight:=3
Range("R6").Select
ActiveCell.FormulaR1C1 = "=TEXT(RC[-12],0)"
Selection.AutoFill Destination:=Range("R6:R4500")
Range("R6:R4500").Select
Columns("R:R").Select
Selection.Copy
Columns("F:F").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Columns("G:G").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight
ActiveWindow.ScrollColumn = 5
ActiveWindow.SmallScroll ToRight:=2
Columns("Z:Z").Select
Selection.Copy
ActiveWindow.ScrollColumn = 1
Columns("G:G").Select
ActiveSheet.Paste
ActiveWindow.ScrollColumn = 4
ActiveWindow.SmallScroll ToRight:=10
Columns("Z:Z").Select
Selection.Copy
ActiveWindow.ScrollColumn = 1
Columns("G:G").Select
ActiveSheet.Paste
Range("G6").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1],Feuil1!R[-4]C[2]:R[2494]C[15],14,0)"
ActiveCell.FormulaR1C1 = _
"=IF(ISNA(VLOOKUP(RC[-1],Feuil1!R[-4]C[2]:R[2494]C[15],14,0)),0,VLOOKUP(RC[-1],Feuil1!R[-4]C[2]:R[2494]C[15],14,0))"
Range("G6").Select
Selection.AutoFill Destination:=Range("G6:G4500"), Type:=xlFillDefault
Range("G6:G4500").Select
ActiveWindow.ScrollRow = 1
Columns("H:H").Select
Selection.Insert Shift:=xlToRight
ActiveWindow.ScrollColumn = 5
ActiveWindow.SmallScroll ToRight:=10
Columns("Z:Z").Select
Selection.Copy
ActiveWindow.ScrollColumn = 1
Columns("H:H").Select
ActiveSheet.Paste
Range("H6").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-2],Feuil3!R[-4]C[-6]:R[2494]C[-3],4,0)"
ActiveCell.FormulaR1C1 = _
"=IF(ISNA(VLOOKUP(RC[-2],Feuil3!R[-4]C[-6]:R[2494]C[-3],4,0)),0,VLOOKUP(RC[-2],Feuil3!R[-4]C[-6]:R[2494]C[-3],4,0))"
Range("H6").Select
Selection.AutoFill Destination:=Range("H6:H4500"), Type:=xlFillDefault
Range("H6:H4500").Select
ActiveWindow.ScrollRow = 1
Columns("I:I").Select
Selection.Insert Shift:=xlToRight
ActiveWindow.ScrollColumn = 5
ActiveWindow.SmallScroll ToRight:=17
Columns("AB:AB").Select
Selection.Copy
ActiveWindow.ScrollColumn = 1
Columns("I:I").Select
ActiveSheet.Paste
Range("I6").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-3],Feuil2!R[-4]C:R[4494]C[10],11,0)"
ActiveCell.FormulaR1C1 = _
"=IF(ISNA(VLOOKUP(RC[-3],Feuil2!R[-4]C:R[4494]C[10],11,0)),0,VLOOKUP(RC[-3],Feuil2!R[-4]C:R[4494]C[10],11,0))"
Range("I6").Select
Selection.AutoFill Destination:=Range("I6:I4500"), Type:=xlFillDefault
Range("I6:I4500").Select
ActiveWindow.ScrollRow = 1
Range("V6").Select
ActiveCell.FormulaR1C1 = _
"=1*(SUMPRODUCT(1-ISNA(MATCH(RC[-4]:RC[-3],{15326366;15326550;15310554},0)))>0)"
Selection.AutoFill Destination:=Range("V6:V4500")
Range("V6:V4500").Select
Range("V6").Select
ActiveCell.FormulaR1C1 = _
"=1*(SUMPRODUCT(1-ISNA(MATCH(RC[-4]:RC[-3],{15326366;15326550;15310554},0)))>0)"
Selection.AutoFill Destination:=Range("V6:V4500")
Range("V6:V4500").Select
Range("F4").Select
ActiveCell.FormulaR1C1 = "11"
Range("G4").Select
ActiveCell.FormulaR1C1 = "22"
Range("H4").Select
ActiveCell.FormulaR1C1 = "33"
Range("I4").Select
ActiveCell.FormulaR1C1 = "44"
Range("V4").Select
ActiveCell.FormulaR1C1 = "55"
Range("W4").Select
ActiveCell.FormulaR1C1 = "66"
Range("X4").Select
ActiveCell.FormulaR1C1 = "77"
Range("Y4").Select
ActiveCell.FormulaR1C1 = "88"
Range("U4").Select
ActiveCell.FormulaR1C1 = "99"
Range("W6").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-16]>=1,1,0)"
ActiveWindow.SmallScroll ToRight:=2
Selection.AutoFill Destination:=Range("W6:W4500")
Range("W6:W4500").Select
Range("X6").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-16]>=1,1,0)"
Range("X6").Select
Selection.AutoFill Destination:=Range("X6:X4500")
Range("X6:X4500").Select
Range("Y6").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-19],Feuil3!R[-4]C[-23]:R[2494]C[-15],9,0)"
ActiveCell.FormulaR1C1 = _
"=IF(ISNA(VLOOKUP(RC[-19],Feuil3!R[-4]C[-23]:R[2494]C[-15],9,0)),0,VLOOKUP(RC[-19],Feuil3!R[-4]C[-23]:R[2494]C[-15],9,0))"
Range("Y6").Select
Selection.AutoFill Destination:=Range("Y6:Y4500")
Range("Y6:Y4500").Select
With Sheets("Feuil4") à partir de là, ça mouline !!!!
For i = Range("U65536").End(xlUp).Row To 2 Step -1
If Cells(i, 21).Value = "0" Then
Cells(i, 2).EntireRow.Delete Shift:=xlUp
End With
End Sub