Re : Recherche du dernier Nom
En supposant que j'ai bien compris, rajouter :
Private Sub Nom_Change()
CommandButton1.Visible = True
avecsolde.Enabled = True
sanssolde.Enabled = True
datecp.Enabled = True
journée.Enabled = True
journée = 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)
If Val(Me.avec) = 0.5 Or Val(Me.sans) = 0.5 Then journée = False: journée.Enabled = False
End With
'Stop
If avec.Value = "N’ouvert pas le droit " And sans.Value = "N’ouvert pas le droit " Then
datecp.Enabled = False
MsgBox ("N'ouvert pas le droit,toutes les CP sont consommées... MERCI")
End If
If avec.Value = "N’ouvert pas le droit " Then
avec.ForeColor = &HFF& 'rouge
avec.BackColor = &HFFFF00 'rouge
End If
If sans.Value = "N’ouvert pas le droit " Then
sans.ForeColor = &HFF& 'rouge
sans.BackColor = &HFFFF00 'rouge
End If
End Sub