Hello à tous,
Je me demande comment je pourrai optimiser le code suivant (réalisé avec l'enregistreur de macro) qui ne fait que des copier coller répétitifs dans une autre feuille.
Le point c'est que lorsque je lance macro cela fait scintiller l'excel et cela prend pas mal de temps.
Voici le code ci-après :
Sub Macro10()
'
' Macro10 Macro
'
'
Sheets("Synthèse").Select
Rows("2:2").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
Selection.Font.Bold = True
Selection.Font.Bold = False
Sheets("IM").Select
Range("D5").Select
Selection.Copy
Sheets("Synthèse").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("C2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K9").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("D2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K11").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("E2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K13").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("F2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K15").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("G2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("N5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("H2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("N7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("I2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("N9").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("J2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("N11").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("K2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("N13").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("L2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("N15").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("M2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K17:N17").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("N2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K19:N19").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("O2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K21:N21").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("P2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
ActiveWindow.SmallScroll Down:=12
Range("K23:N23").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("Q2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K25").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("R2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("N25").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("S2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K27:O27").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("T2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
ActiveWindow.SmallScroll Down:=-21
Range("D5").Select
End Sub
Merci pour vos réponses
Je me demande comment je pourrai optimiser le code suivant (réalisé avec l'enregistreur de macro) qui ne fait que des copier coller répétitifs dans une autre feuille.
Le point c'est que lorsque je lance macro cela fait scintiller l'excel et cela prend pas mal de temps.
Voici le code ci-après :
Sub Macro10()
'
' Macro10 Macro
'
'
Sheets("Synthèse").Select
Rows("2:2").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
Selection.Font.Bold = True
Selection.Font.Bold = False
Sheets("IM").Select
Range("D5").Select
Selection.Copy
Sheets("Synthèse").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("C2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K9").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("D2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K11").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("E2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K13").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("F2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K15").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("G2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("N5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("H2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("N7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("I2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("N9").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("J2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("N11").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("K2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("N13").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("L2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("N15").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("M2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K17:N17").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("N2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K19:N19").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("O2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K21:N21").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("P2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
ActiveWindow.SmallScroll Down:=12
Range("K23:N23").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("Q2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K25").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("R2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("N25").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("S2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
Range("K27:O27").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Synthèse").Select
Range("T2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("IM").Select
ActiveWindow.SmallScroll Down:=-21
Range("D5").Select
End Sub
Merci pour vos réponses