Private Sub userform_initialize()
Dim ref_principal As String, i, date_ref_modif, date_source_modif, ligne As Integer
'identification du fichier source
nf = Application.GetOpenFilename("fichiers Xlsm,*.xlsm")
If Not nf = False Then
Workbooks.Open Filename:=nf
End If
With Sheets("LoP")
For i = 2 To .Range("C65000").End(xlUp).Row
ref_principal = .Range("C" & i)
date_ref_modif = .Range("O" & i)
'identification des lignes avec le même ID:
On Error Resume Next
ligne = WorksheetFunction.Match(ref_principal, Workbooks(nf).Worksheets("Lop").Range("C3:C500"), 0)
date_source_modif = Workbooks(nf).Worksheets("LoP").Range("0" & ligne)
'comparaison des dates des dernière modification
If date_ref_modif <> date_source_modif Then
'affichage si différent
TextBox1.Value = .Range("J" & i).Value
TextBox2.Value = Workbooks(nf).Worksheets("LoP").Range("J" & ligne).Value
End If
'confirmation ou non de la modification:
If Bt_Yes.Value = True Then
.Range("J" & i).Value = Workbooks(nf).Worksheets("LoP").Range("J" & ligne).Value
End If
If Bt_No.Value = True Then
Next
End If
End With
End Sub