Copier certaines données vers une autre feuille

hatem1234

XLDnaute Junior
Bonjour,
Je ne trouve pas comment copier les données de la dernière colonne d'une plage sachant que cette colonne est variable cad peut changer selon si elle contient ou non des données
Voir fichier joint pour plus d'info et merci d'avance pour toute aide
 

Pièces jointes

  • test.xlsm
    52.1 KB · Affichages: 6

mapomme

XLDnaute Barbatruc
Supporter XLD
Bonsoir @hatem1234,

Essayez :
VB:
Sub btn_print_Clic()
Dim tablo, ligEcrit&, i&
  Application.ScreenUpdating = False
  With Sheets("Accueil")
    i = .Cells(.Rows.Count, "b").End(xlUp).Row
    tablo = .Range("b25:bw" & i)
  End With

  With Sheets("Liste")
    .Range("A2", .UsedRange.Cells(.UsedRange.Cells.Count)).ClearContents
    ligEcrit = 2
    For i = 1 To UBound(tablo) Step 2
      .Cells(ligEcrit, "b") = tablo(i, 1)  ' Nom
      .Cells(ligEcrit, "c") = tablo(i, 21)  'date
      With Sheets("accueil")
        On Error Resume Next
        Sheets("Liste").Cells(ligEcrit, "d") = .Cells(24 + i, Range("ab1").Column - 1 + Application.Match(9E+99, .Range(.Cells(24 + i, "ab"), .Cells(24 + i, "bo")), 1))
        On Error GoTo 0
      End With
      ligEcrit = ligEcrit + 1
    Next i
  End With
  Application.ScreenUpdating = True
End Sub
 

Pièces jointes

  • hatem1234- derniere colonne- v1b.xlsm
    53.9 KB · Affichages: 4
Dernière édition:

Discussions similaires

Réponses
30
Affichages
1 K
Réponses
22
Affichages
755

Statistiques des forums

Discussions
312 169
Messages
2 085 909
Membres
103 032
dernier inscrit
etima