Re : Recherche du dernier Nom
Remplace la procédure par celle-ci (après tu mets les couleurs que tu veux)
Private Sub Nom_Change()
avecsolde.Enabled = True
sanssolde.Enabled = True
datecp.Enabled = True
avec.ForeColor = &H80000012 'rouge
sans.ForeColor = &H80000012 'rouge
avec.BackColor = &H8000000F 'rouge
sans.BackColor = &H8000000F 'rouge
derligne = Sheets("FSCP").Range("B65536").End(xlUp).Row
For i = derligne To 3 Step -1
If Cells(i, 2) = Nom Then col = i: i = 3
Next i
With Sheets("Liste")
Me.prénom = .Cells(Me.Nom.ListIndex + 2, 2)
Me.fonction = .Cells(Me.Nom.ListIndex + 2, 3)
Me.structure = .Cells(Me.Nom.ListIndex + 2, 4)
End With
With Sheets("FSCP")
If col = "" Then Me.avec = 5 Else Me.avec = .Cells(col, 12)
If col = "" Then Me.sans = 5 Else Me.sans = .Cells(col, 13)
End With
'Stop
If avec.Value = "N’ouvert pas le droit " And sans.Value = "N’ouvert pas le droit " Then
avec.ForeColor = &HFF& 'rouge
sans.ForeColor = &HFF& 'rouge
avec.BackColor = &HFFFF00 'rouge
sans.BackColor = &HFFFF00 'rouge
datecp.Enabled = False
MsgBox ("N'ouvert pas le droit,toutes les CP sont consommées... MERCI")
Exit Sub
End If
End Sub