ReL'essentiel étant que @cloud7801 considère que ton code règle son problème c'est donc parfait.
Sub insertLigne()
Dim i&
For i = Cells(Rows.Count, "e").End(xlUp).Row To 1 Step -1
Cells(i, 5).Copy: Cells(i, 5).Insert Shift:=xlDown
Next
End Sub
188453 PLVT 03/2022 FACTURE CTR 188453 |
188453 PLVT 03/2022 FACTURE CTR 188453 |
188517 PLVT 03/2022 FACTURE CTR 188517 |
188517 PLVT 03/2022 FACTURE CTR 188517 |
189164 PLVT 03/2022 FACTURE CTR 189164 |
189164 PLVT 03/2022 FACTURE CTR 189164 |
Sub insertLigne()
Dim i&
For i = Cells(Rows.Count, "e").End(xlUp).Row To 1 Step -1
Cells(i, 5).Insert Shift:=xlDown
Cells(i, 5).Resize(2).Value = Cells(i, 5).Offset(1).Value & " PLVT 03/2022 FACTURE CTR " & Cells(i, 5).Offset(1).Value
Next
End Sub
Sub Test_DoubleLignesColonne()
Call DoubleLignesColonne(ActiveSheet, 5, " PLVT 03/2022 FACTURE CTR ")
End Sub
Sub DoubleLignesColonne(Wsh As Worksheet, NoColonne As Integer, AjoutChaine As String)
Dim Tab1() As Variant
Dim Tab2() As Variant
Dim NbLignes As Long
Dim i As Long
Const NbLignesTitre = 0
With Wsh
'Défiltrer pour ne pas fausser le xlUp avec des lignes de fin filtrées
If Not .AutoFilter Is Nothing Then .AutoFilter.ShowAllData
NbLignes = .Cells(Rows.Count, NoColonne).End(xlUp).Row
Tab1 = .Cells(NbLignesTitre + 1, NoColonne).Resize(NbLignes - NbLignesTitre).Value
ReDim Tab2(1 To UBound(Tab1, 1) * 2, 1 To 1)
For i = 1 To UBound(Tab1, 1)
Tab2(i * 2 - 1, 1) = Tab1(i, 1) & AjoutChaine & Tab1(i, 1)
Tab2(i * 2, 1) = Tab2(i * 2 - 1, 1)
Next i
.Cells(NbLignesTitre + 1, NoColonne).Resize((UBound(Tab2, 1))).Value = Tab2
End With
End Sub
Re..Version @Jacky67: (ça y est je parle en son nom)
VB:Sub insertLigne() Dim i& For i = Cells(Rows.Count, "e").End(xlUp).Row To 1 Step -1 Cells(i, 5).Insert Shift:=xlDown Cells(i, 5).Resize(2).Value = Cells(i, 5).Offset(1).Value & " PLVT 03/2022 FACTURE CTR " & Cells(i, 5).Offset(1).Value Next End Sub
C'est un commentaire (commence par une simple quote).mais juste une question, la phrase "'Défiltrer pour ne pas fausser le xlUp avec des lignes de fin filtrées" je dois aussi la copier dans la macro?
Re..RE JACKY ET DUDU,
J'ai essayer le code de DUDU, il y a quelques imperfection, mais avec des copier coller et des changements, sa passe, donc merci a vous.
ps: en gros, au lieu de coller la ligne E qu'à la fin de "PLVT 03/2022 FACTURE CTR", il la coller au début et a la fin "188453 PLVT 03/2022 FACTURE CTR 188453"
et en exécutant le code, ça double la ligne, j'ai donc utiliser une version ou je n'avais pas préalablement doubler avec le premier code, et haleluhia
En gros, le seul bémol qu'il reste, c'est qu'il y a "188453 PLVT 03/2022 FACTURE CTR 188453", il faudrais "PLVT 03/2022 FACTURE CTR 188453"
Mais c'est un petit détail, un granD MERCI
Sub insertLigne()
Dim i&
For i = Cells(Rows.Count, "e").End(xlUp).Row To 1 Step -1
Cells(i, "f") = Cells(i, "f") & Cells(i, "e")
Range("e" & i & ":f" & i).Copy: Cells(i, 5).Insert Shift:=xlDown
Next
End Sub