Bonsoir les amis :)
Je rencontre un problème que je ne pensais absolument pas rencontré ! surtout après 3 mois d'apprentissage de VBA
En quittant la feuille F3, je voudrais qu'une cellule donnée de la feuille F3 soit copiée et collée dans une cellule donnée de la feuille F4.
Le fichier exemple est joint. Voici le code que j'ai mis :
Private Sub WorkSheet__Deactivate()
Dim i As Integer, DerLig As Integer, DerLig2 As Integer, EnregExiste As Boolean
DerLig = Sheets("F3").Cells(Rows.Count, 6).End(xlUp).Row
DerLig2 = Sheets("F4").Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To DerLig2
If Sheets("F3").Cells(DerLig, 6) = Sheets("F4").Cells(i, 1) Then EnregExiste = True: Exit For
Next i
If Not EnregExiste Then
i = Sheets("F4").Cells(Rows.Count, 1).End(xlUp).Row + 1
Sheets("F3").Cells(DerLig, 6).Copy
Sheets("F4").Cells(i, 1).Pastspecial Paste:=xlPasteValues
End If
End Sub
Si quelqu'un pourra m'aider je lui en serai reconnaissant :)
Me