appliquer macro à plusieurs lignes

lsteen

XLDnaute Nouveau
Bonjour à tous,

Je souhaiterais appliquer la macro de la première ligne (ligne 4) sur toutes les lignes du dessous.

Est ce que vous avez une idée pour m'aider.

Merci d'avance.
 

Pièces jointes

  • Avancement processus - Copy.xlsm
    48.4 KB · Affichages: 37

Paritec

XLDnaute Barbatruc
Re : appliquer macro à plusieurs lignes

Bonsoir Isteen le forum
voilà ton fichier en retour
j'ai supposé que c'était pas pour toutes les lignes mais toutes les trois lignes,(comme tu ne le disais pas naturellement )
a+
Papou:eek:

Code:
Sub TEST_1()
    Dim i&
    With Sheet5
        For i = 4 To .Range("B" & Rows.Count).End(xlUp).Row Step 3
            If Not IsEmpty(.Cells(i, 5)) Then .Cells(i, 3) = .Range("E2") Else .Cells(i, 3) = ""
            If Not IsEmpty(.Cells(i, "I")) Then .Cells(i, 3) = Range("I2")
            If Not IsEmpty(.Cells(i, "M")) Then .Cells(i, 3) = Range("M2")
            If Not IsEmpty(.Cells(i, "Q")) Then .Cells(i, 3) = Range("Q2")
            If Not IsEmpty(.Cells(i, "V")) Then .Cells(i, 3) = Range("V2")
            If Not IsEmpty(.Cells(i, "Y")) Then .Cells(i, 3) = Range("Y2")
            If Not IsEmpty(.Cells(i, "AC")) Then .Cells(i, 3) = Range("AC2")
            If Not IsEmpty(.Cells(i, "AG")) Then .Cells(i, 3) = Range("AG2")
        Next i
    End With
End Sub
 

Pièces jointes

  • Isteen V1.xlsm
    50.2 KB · Affichages: 30
Dernière édition:

Paritec

XLDnaute Barbatruc
Re : appliquer macro à plusieurs lignes

Re bonjour Isteen le forum
bon pas de réponse alors j'ai modifié la macro pour la rendre plus belle
ton fichier ci-dessous avec la modification
a+
Papou:eek:

Code:
Sub TEST_1()
    Dim i&, a
    Application.ScreenUpdating = 0
    With Sheet5
        For i = 4 To .Range("B" & Rows.Count).End(xlUp).Row Step 3
            If Not IsEmpty(.Cells(i, 5)) Then .Cells(i, 3) = .Range("E2") Else .Cells(i, 3) = ""
            For Each a In Array("I", "M", "Q", "Y", "AC", "AG")
                If Not IsEmpty(.Cells(i, a)) Then .Cells(i, 3) = .Cells(2, a)
            Next a
        Next i
    End With
End Sub
 

Pièces jointes

  • Isteen V2.xlsm
    51.1 KB · Affichages: 20

Discussions similaires

Statistiques des forums

Discussions
312 681
Messages
2 090 881
Membres
104 683
dernier inscrit
stefff