Bonjour, j'ai cherché la réponse à mon problème sur ce forum mais je ne l'ai pas trouvé.
J'utilise une macro qui copie les données remplies sur un formulaire, et les colle sur une liste de données. La macro fonctionne, toutes les données s'affichent sur la liste. Seulement quand j'active la macro, elle met beaucoup de temps à marcher et un gros bug s'affiche à l'écran (ça rame). Je n'arrive pas à savoir si c'est le code qui est incomplet ou s'il est trop long.
Est ce que vous pourriez m'aider à résoudre ce problème?
Je vous joins le code entier ci dessous.
Merci d'avance
Sub SaisieSortie()
'
' SaisieSortie Macro
'
'
Sheets("Liste saisie des stocks").Select
Rows("5:5").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A5").Select
Sheets("Saisie SORTIES").Select
Range("C8").Select
Selection.Copy
Sheets("Liste saisie des stocks").Select
ActiveSheet.Paste
Sheets("Saisie SORTIES").Select
Range("C11").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Liste saisie des stocks").Select
Range("B5").Select
ActiveSheet.Paste
Sheets("Saisie SORTIES").Select
Range("E11").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Liste saisie des stocks").Select
Range("C5").Select
ActiveSheet.Paste
Sheets("Liste saisie des stocks").Select
Range("D5").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Sortie"
Range("E5").Select
Sheets("Saisie SORTIES").Select
Range("E8").Select
Selection.Copy
Sheets("Liste saisie des stocks").Select
ActiveSheet.Paste
Range("F5").Select
Sheets("Saisie SORTIES").Select
Range("G8").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Liste saisie des stocks").Select
ActiveSheet.Paste
Sheets("Saisie SORTIES").Select
Range("C14").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Liste saisie des stocks").Select
Range("G5").Select
ActiveSheet.Paste
Sheets("Saisie SORTIES").Select
Range("C17").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Liste saisie des stocks").Select
Range("H5").Select
ActiveSheet.Paste
Sheets("Saisie SORTIES").Select
Range("C20").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Liste saisie des stocks").Select
Range("I5").Select
ActiveSheet.Paste
Sheets("Saisie SORTIES").Select
Range("E20").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Liste saisie des stocks").Select
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
Range("L5").Select
ActiveSheet.Paste
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Rows("5:5").Select
Application.CutCopyMode = False
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = True
Selection.Font.Bold = False
With Selection.Font
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
End With
With Selection.Font
.Name = "Century Gothic"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("B5").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("E5").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("F5").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("G5").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("H5").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("I5").Select
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("A5:L5").Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Sheets("Liste saisie des stocks").Select
Range("A5").Select
Sheets("Saisie SORTIES").Select
Range("E20,C20,C17,C14").Select
Range("C14").Activate
Selection.ClearContents
Range("C14").Select
End Sub
J'utilise une macro qui copie les données remplies sur un formulaire, et les colle sur une liste de données. La macro fonctionne, toutes les données s'affichent sur la liste. Seulement quand j'active la macro, elle met beaucoup de temps à marcher et un gros bug s'affiche à l'écran (ça rame). Je n'arrive pas à savoir si c'est le code qui est incomplet ou s'il est trop long.
Est ce que vous pourriez m'aider à résoudre ce problème?
Je vous joins le code entier ci dessous.
Merci d'avance
Sub SaisieSortie()
'
' SaisieSortie Macro
'
'
Sheets("Liste saisie des stocks").Select
Rows("5:5").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A5").Select
Sheets("Saisie SORTIES").Select
Range("C8").Select
Selection.Copy
Sheets("Liste saisie des stocks").Select
ActiveSheet.Paste
Sheets("Saisie SORTIES").Select
Range("C11").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Liste saisie des stocks").Select
Range("B5").Select
ActiveSheet.Paste
Sheets("Saisie SORTIES").Select
Range("E11").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Liste saisie des stocks").Select
Range("C5").Select
ActiveSheet.Paste
Sheets("Liste saisie des stocks").Select
Range("D5").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Sortie"
Range("E5").Select
Sheets("Saisie SORTIES").Select
Range("E8").Select
Selection.Copy
Sheets("Liste saisie des stocks").Select
ActiveSheet.Paste
Range("F5").Select
Sheets("Saisie SORTIES").Select
Range("G8").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Liste saisie des stocks").Select
ActiveSheet.Paste
Sheets("Saisie SORTIES").Select
Range("C14").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Liste saisie des stocks").Select
Range("G5").Select
ActiveSheet.Paste
Sheets("Saisie SORTIES").Select
Range("C17").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Liste saisie des stocks").Select
Range("H5").Select
ActiveSheet.Paste
Sheets("Saisie SORTIES").Select
Range("C20").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Liste saisie des stocks").Select
Range("I5").Select
ActiveSheet.Paste
Sheets("Saisie SORTIES").Select
Range("E20").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Liste saisie des stocks").Select
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
Range("L5").Select
ActiveSheet.Paste
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Rows("5:5").Select
Application.CutCopyMode = False
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = True
Selection.Font.Bold = False
With Selection.Font
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
End With
With Selection.Font
.Name = "Century Gothic"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("B5").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("E5").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("F5").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("G5").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("H5").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Range("I5").Select
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("A5:L5").Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Sheets("Liste saisie des stocks").Select
Range("A5").Select
Sheets("Saisie SORTIES").Select
Range("E20,C20,C17,C14").Select
Range("C14").Activate
Selection.ClearContents
Range("C14").Select
End Sub