Correction code remplissage tableau

Bonjour,

je souhaite appliquer ce code qui marche bien sauf que je souhaite l'appliquer sur des lignes que je spécifie moi meme et pas toutes les lignes de 17 à 1545 par exemple je veux qu'il s'applique sur les lignes 35 à 69 puis sur la ligne 89 jusqu'à 141 et de 214 à 303 ainsi de suite

j'espère que je me suis bien expliquée

Cordialement

Option Explicit

Dim fb As Worksheet, fb1 As Worksheet, i&, t&

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Count > 1 Or Target.Address <> "$B$2" Then Exit Sub

Set fb = Sheets("feuil10")

Application.EnableEvents = False

For i = 17 To 1545 Step 18

Range(Cells(i, "E"), Cells(i, "P")).ClearContents

For t = 2 To 1774

If fb.Range("D" & t) = Target And fb.Range("C" & t) = Range("C" & i) Then

fb.Range("E" & t & ":P" & t).Copy Range("E" & i)

Exit For

End If

Next t

Next i

Bonjour,

Avec un Select Case peut être ?

Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Count > 1 Or Target.Address <> "$B$2" Then Exit Sub

    Set fb = Sheets("feuil10")
    Application.EnableEvents = False

    For i = 17 To 1545 '<-- ici la valeur maximale !

        Select Case i

            Case 35 To 69, 89 To 141, 214 To 303 'etc...

                Range(Cells(i, "E"), Cells(i, "P")).ClearContents

                For t = 2 To 1774

                    If fb.Range("D" & t) = Target And fb.Range("C" & t) = Range("C" & i) Then

                        fb.Range("E" & t & ":P" & t).Copy Range("E" & i)

                        Exit For

                    End If

        End Select

    Next t, i

    Application.EnableEvents = True

End Sub
Rechercher des sujets similaires à "correction code remplissage tableau"