Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

insertion de lignes - FFO

3 réponses
Avatar
Sunburn
Bonjour,
message qui fait suite aux divers échanges avec FFO, qui m'a donner le code
pour l'insertion de lignes dans mon tableau.
voilà, en fait, lorque je lance une macro, qui en fait efface des données
dans toutes mes feuilles, et bien, lorsqu'il arrive à l'onglet 80_31, il
plante, et il cré une ligne en-dessous de la 4, alors qu'il ne doit commencer
qu'à la 12....
pourquoi ?
PS : j'ai le meme type de code sur 3 onglets différents, peut être qu'il
confond les codes à force, non ?
si tu as une idée, je suis preneur ....
RAPPEL :
----- sur la feuille 80_31
Private Sub CommandButton1_Click()
Tableau_80_31
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Interior.ColorIndex = 36 And Target.Offset(1,
0).Interior.ColorIndex = xlNone And Cells(Target.Row, Target.Column) <> ""
Then
Target.EntireRow.Copy
Target.Offset(1, 0).EntireRow.Insert Shift:=xlDown
Target.Offset(1, 0).ClearContents
Target.Offset(-1, 0).EntireRow.Copy
Target.EntireRow.PasteSpecial Paste:=xlPasteFormats
Lettre = "B/C/D/E/F/G/H/I/K/L/M/N/O/P/Q/T"
For i = 0 To UBound(Split(Lettre, "/"))
Colonne = Split(Lettre, "/")(i)
Range(Colonne & Target.Row + 2).Formula = Split(Range(Colonne & Target.Row +
2).Formula, ":")(0) & ":" & Mid(Split(Range(Colonne & Target.Row +
2).Formula, ":")(1), 1, 1) & Mid(Split(Range(Colonne & Target.Row +
2).Formula, ":")(1), 2, Len(Mid(Split(Range(Colonne & Target.Row +
2).Formula, ":")(1), 2)) - 1) + 1 & ")"
Next
Range("S" & Target.Row + 2).Formula = Split(Range("S" & Target.Row +
2).Formula, ":")(0) & ":" & Mid(Split(Range("S" & Target.Row + 2).Formula,
":")(1), 1, 1) & Mid(Split(Range("S" & Target.Row + 2).Formula, ":")(1), 2,
Len(Mid(Split(Range("S" & Target.Row + 2).Formula, ":")(1), 2)) - 4) + 1 &
")+S8"
Range("R" & Target.Row + 2).Formula = Mid(Range("R" & Target.Row +
2).Formula, 1, 2) & Mid(Range("R" & Target.Row + 2).Formula, 3) + 1
End If
Application.CutCopyMode = False
End Sub
---------
mais aussi :
----- sur la feuille 60_21
Private Sub CommandButton1_Click()
Tableau_60_21
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Offset(1, 0).Interior.ColorIndex = xlNone And
Target.Interior.ColorIndex = 36 And Cells(Target.Row, Target.Column) <> ""
Then
Formule1 = Range("D" & Target.Row + 1).Formula
Formule2 = Range("E" & Target.Row + 1).Formula
Target.EntireRow.Copy
Target.Offset(1, 0).EntireRow.Insert Shift:=xlDown
Target.Offset(1, 0).ClearContents
Target.Offset(-1, 0).EntireRow.Copy
Target.EntireRow.PasteSpecial Paste:=xlPasteFormats
Range("D" & Target.Row + 2).Formula = Split(Range("D" & Target.Row +
2).Formula, ":")(0) & ":" & Mid(Split(Range("D" & Target.Row + 2).Formula,
":")(1), 1, 1) & Mid(Split(Range("D" & Target.Row + 2).Formula, ":")(1), 2,
Len(Mid(Split(Range("D" & Target.Row + 2).Formula, ":")(1), 2)) - 1) + 1 & ")"
Range("E" & Target.Row + 2).Formula = Split(Range("E" & Target.Row +
2).Formula, ":")(0) & ":" & Mid(Split(Range("E" & Target.Row + 2).Formula,
":")(1), 1, 1) & Mid(Split(Range("E" & Target.Row + 2).Formula, ":")(1), 2,
Len(Mid(Split(Range("E" & Target.Row + 2).Formula, ":")(1), 2)) - 1) + 1 & ")"
End If
Application.CutCopyMode = False
End Sub
------
et aussi
------- sur la feuille 90_31
Private Sub CommandButton1_Click()
Tableau_90_31
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Offset(1, 0).Interior.ColorIndex = xlNone And
Target.Interior.ColorIndex = 36 And Cells(Target.Row, Target.Column) <> ""
Then
Formule1 = Range("D" & Target.Row + 1).Formula
Formule2 = Range("E" & Target.Row + 1).Formula
Target.EntireRow.Copy
Target.Offset(1, 0).EntireRow.Insert Shift:=xlDown
Target.Offset(1, 0).ClearContents
Target.Offset(-1, 0).EntireRow.Copy
Target.EntireRow.PasteSpecial Paste:=xlPasteFormats
Range("D" & Target.Row + 2).Formula = Split(Range("D" & Target.Row +
2).Formula, ":")(0) & ":" & Mid(Split(Range("D" & Target.Row + 2).Formula,
":")(1), 1, 1) & Mid(Split(Range("D" & Target.Row + 2).Formula, ":")(1), 2,
Len(Mid(Split(Range("D" & Target.Row + 2).Formula, ":")(1), 2)) - 1) + 1 & ")"
Range("E" & Target.Row + 2).Formula = Split(Range("E" & Target.Row +
2).Formula, ":")(0) & ":" & Mid(Split(Range("E" & Target.Row + 2).Formula,
":")(1), 1, 1) & Mid(Split(Range("E" & Target.Row + 2).Formula, ":")(1), 2,
Len(Mid(Split(Range("E" & Target.Row + 2).Formula, ":")(1), 2)) - 1) + 1 & ")"
End If
Application.CutCopyMode = False
End Sub
------

3 réponses

Avatar
FFO
Salut à toi

Je crois me souvenir que la cellule A4 est de couleur jaune (code 36) et
répond à toutes les conditions d'éxécution du code décrit dans la ligne :

If Target.Interior.ColorIndex = 36 And Target.Offset(1,
0).Interior.ColorIndex = xlNone And Cells(Target.Row, Target.Column) <> ""
Then


Soit tu changes sa couleur soit tu rajoutes dans cette ligne de code une
condition pour démarrer aprés la ligne 4 ainsi :

If Target.Interior.ColorIndex = 36 And Target.Offset(1,
0).Interior.ColorIndex = xlNone And Cells(Target.Row, Target.Column) <> ""
And Target.Row > 4 Then

Celà devrait convenir
Dis moi !!!
Avatar
Sunburn
Ok, je vais essayer.
merci
YANN

"FFO" a écrit :

Salut à toi

Je crois me souvenir que la cellule A4 est de couleur jaune (code 36) et
répond à toutes les conditions d'éxécution du code décrit dans la ligne :

If Target.Interior.ColorIndex = 36 And Target.Offset(1,
0).Interior.ColorIndex = xlNone And Cells(Target.Row, Target.Column) <> ""
Then


Soit tu changes sa couleur soit tu rajoutes dans cette ligne de code une
condition pour démarrer aprés la ligne 4 ainsi :

If Target.Interior.ColorIndex = 36 And Target.Offset(1,
0).Interior.ColorIndex = xlNone And Cells(Target.Row, Target.Column) <> ""
And Target.Row > 4 Then

Celà devrait convenir
Dis moi !!!



Avatar
Sunburn
Impecable, j'ai changé la couleur en A4, et c'est nikel krome.

merci beaucoup.
YANN

"FFO" a écrit :

Salut à toi

Je crois me souvenir que la cellule A4 est de couleur jaune (code 36) et
répond à toutes les conditions d'éxécution du code décrit dans la ligne :

If Target.Interior.ColorIndex = 36 And Target.Offset(1,
0).Interior.ColorIndex = xlNone And Cells(Target.Row, Target.Column) <> ""
Then


Soit tu changes sa couleur soit tu rajoutes dans cette ligne de code une
condition pour démarrer aprés la ligne 4 ainsi :

If Target.Interior.ColorIndex = 36 And Target.Offset(1,
0).Interior.ColorIndex = xlNone And Cells(Target.Row, Target.Column) <> ""
And Target.Row > 4 Then

Celà devrait convenir
Dis moi !!!