papillon.matthieu
XLDnaute Nouveau
Bonjour,
Je viens vers vous en espérant trouver une réponse à ma question: j'ai programmé une macro pour faire des copier-coller si une case est supérieure ou égale à 16 dans une autre feuille
Concrètement j'ai 2 problèmes:
- Il ne va pas chercher toutes les lignes en question dans la Feuil1
- les copier - coller dans la Feuil2 se font tous sur la meme ligne, ce qui ne sert à rien
Mon code ci dessous
Dim n
Range("A13").Select
Range(Selection, Selection.End(xlDown)).Select
n = Selection.Rows.Count
Dim i
i = 1
If Cells(i, 9) >= 16 Then
For i = 1 To n
Dim j
j = 10
Cells(i, 1).Select
Selection.Copy
Sheets("Feuil1").Select
Cells(j, 1).Select
ActiveSheet.Paste
Sheets("Feuil2").Select
Cells(i, 2).Select
Selection.Copy
Sheets("Feuil1").Select
Cells(j, 2).Select
ActiveSheet.Paste
Sheets("Feuil2").Select
Cells(i, 4).Select
Selection.Copy
Sheets("Feuil1").Select
Cells(j, 3).Select
ActiveSheet.Paste
Sheets("Feuil2").Select
Cells(i, 6).Select
Selection.Copy
Sheets("Feuil1").Select
Cells(j, 4).Select
ActiveSheet.Paste
Sheets("Feuil2").Select
Cells(i, 8).Select
Selection.Copy
Sheets("Feuil1").Select
Cells(j, 5).Select
ActiveSheet.Paste
Sheets("Feuil2").Select
Cells(i, 12).Select
Selection.Copy
Sheets("Feuil1").Select
Cells(j, 6).Select
ActiveSheet.Paste
Sheets("Feuil2").Select
j = j + 1
Next i
End If
D'avance merci pour votre aide
Je viens vers vous en espérant trouver une réponse à ma question: j'ai programmé une macro pour faire des copier-coller si une case est supérieure ou égale à 16 dans une autre feuille
Concrètement j'ai 2 problèmes:
- Il ne va pas chercher toutes les lignes en question dans la Feuil1
- les copier - coller dans la Feuil2 se font tous sur la meme ligne, ce qui ne sert à rien
Mon code ci dessous
Dim n
Range("A13").Select
Range(Selection, Selection.End(xlDown)).Select
n = Selection.Rows.Count
Dim i
i = 1
If Cells(i, 9) >= 16 Then
For i = 1 To n
Dim j
j = 10
Cells(i, 1).Select
Selection.Copy
Sheets("Feuil1").Select
Cells(j, 1).Select
ActiveSheet.Paste
Sheets("Feuil2").Select
Cells(i, 2).Select
Selection.Copy
Sheets("Feuil1").Select
Cells(j, 2).Select
ActiveSheet.Paste
Sheets("Feuil2").Select
Cells(i, 4).Select
Selection.Copy
Sheets("Feuil1").Select
Cells(j, 3).Select
ActiveSheet.Paste
Sheets("Feuil2").Select
Cells(i, 6).Select
Selection.Copy
Sheets("Feuil1").Select
Cells(j, 4).Select
ActiveSheet.Paste
Sheets("Feuil2").Select
Cells(i, 8).Select
Selection.Copy
Sheets("Feuil1").Select
Cells(j, 5).Select
ActiveSheet.Paste
Sheets("Feuil2").Select
Cells(i, 12).Select
Selection.Copy
Sheets("Feuil1").Select
Cells(j, 6).Select
ActiveSheet.Paste
Sheets("Feuil2").Select
j = j + 1
Next i
End If
D'avance merci pour votre aide