Re bonjour job75,
Juste une petite question:
J'aimerais ajouter un format date dans la colonne 4 et 5 du formulaire comme ceci
mercredi, 14 mars 2020, mais ma correction ne fonctionne pas, voici le code
Private Sub CommandButton2_Click() 'Transfert en bloc
Dim d As Object, i&, x$, ligne&
Set d = CreateObject("Scripting.Dictionary")
With [Tableau1]
For i = 1 To .Rows.Count
x = .Cells(i, 1) & .Cells(i, 2) & .Cells(i, 3) & .Cells(i, 4) & .Cells(i, 5)
If Not d.exists(x) Then d(x) = i 'mémorise la ligne
Next
End With
ligne = 2
With Sheets("Transfert")
.Range("A2:E" & .Rows.Count).Clear
For i = 0 To ListBox1.ListCount - 1
With ListBox1: x = .List(i, 0) & .List(i, 1) & .List(i, 2) & .List(i, 3) & .List(i, 4): End With
If d.exists(x) Then
[Tableau1].Rows(d(x)).Copy .Rows(ligne)
.Cells(ligne, 1).Validation.Delete 'supprime la liste de validation éventuelle
ligne = ligne + 1
End If
Next
.Cells(ligne, 2) = "Total"
.Cells(ligne, 3) = "=SUM(C1:C" & ligne - 1 & ")"
.Cells(ligne, 3).NumberFormat = "#,##0.00"
.Cells(ligne, 2).Resize(, 2).Font.Bold = True 'gras
.Cells(ligne, 4).Date = "dddd dd mmmmm yyyy" 'Format de la date
.Cells(ligne, 5).Date = "dddd dd mmmmm yyyy" 'Format de la date
.Visible = xlSheetVisible 'si la feuille est masquée
Application.GoTo .[A1]
End With
Unload UserForm1
End Sub