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 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| Sub LancerImpressionFacturesNouvelleMacro()
Dim MotCle
Dim i As Byte
Dim C As Range
Dim F As String
Dim Ligne As Long
Sheets.Add
ActiveSheet.Name = "sheet1"
Sheets.Add
ActiveSheet.Name = "sheet2"
Sheets.Add
ActiveSheet.Name = "sheet3"
Sheets.Add
ActiveSheet.Name = "sheet4"
Sheets.Add
ActiveSheet.Name = "sheet5"
Sheets.Add
ActiveSheet.Name = "sheet6"
Sheets.Add
ActiveSheet.Name = "sheet7"
Sheets.Add
ActiveSheet.Name = "sheet8"
Sheets.Add
ActiveSheet.Name = "sheet9"
Sheets.Add
ActiveSheet.Name = "sheet10"
Sheets("Données_fin").Select
Sheets("Données_fin").Copy Before:=Sheets(3)
Sheets("Données_fin (2)").Select
Sheets("Données_fin (2)").Name = "Résumé"
Application.Run "CodeMut"
'On définit les mots clés
MotCle = Array("101", "108", "109", "126", "128", "129", "130", "132", "134", "135", "137", "203", "203", "206", "216", "226", "228", "232", "305", "306", "315", "317", "319", "323", "325", "403", "409", "501", "506", "509", "516", "526", "527", "602", "605", "609", "622", "871", "910", "940", "951")
'On effectue la recherche de chaque mot clé dans la colonne F de la sheet1
For i = 0 To UBound(MotCle)
Do
Set C = Worksheets("Données_fin").Columns(10).Find(MotCle(i), LookIn:=xlValues, lookat:=xlPart)
'Si le mot clé est trouvé
If Not C Is Nothing Then
'On définit le nom de la feuille où sera effectuée la copie
F = "sheet" & (i + 2)
With Worksheets(F)
'On définit la ligne où sera effectué le collage
Ligne = .Range("F" & Rows.Count).End(xlUp).Row + 1
'On effectue le copier / coller
C.EntireRow.Copy .Range("A" & Ligne)
'On supprime la ligne dans la sheet1
C.EntireRow.Delete
End With
End If
Loop While Not C Is Nothing
Next i
Sheets("Données_fin").Select
Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True
Sheets("Menu").Select
Sheets("Menu").Move Before:=Sheets(1)
Sheets("Résumé").Select
Sheets("Résumé").Move Before:=Sheets(2)
End Sub |
Partager