Bonjour,
Une solution sans passez par un USERFORM, mais via double clic sur votre plage. Code à placer dans le module de la feuille BDD :
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
With ActiveSheet
LR = .Cells(.Rows.Count, 1).End(xlUp).Row
If Not Application.Intersect(Target, .Range(.Cells(2, 1), .Cells(LR, 1))) Is Nothing Then
If MsgBox("Confirmez vous le pointage de " & Target & " à " & Now, vbInformation + vbOKCancel) = vbOK Then
With Worksheets("Historique pointage")
LR = .Cells(.Rows.Count, 1).End(xlUp).Row
NOM_C = "'Historique pointage'!A1:A" & LR
DATE_C = "'Historique pointage'!B1:B" & LR
If Application.Evaluate("=COUNTIFS(" & NOM_C & ",""" & Target & """," & DATE_C & "," & CLng(Date) & ")") > 0 Then
MsgBox "Pointage déjà réalisé ce jour pour cette personne", vbCritical
Else
.Cells(LR, 1).Offset(1) = Target
.Cells(LR, 2).Offset(1) = Date
.Cells(LR, 3).Offset(1) = CDate(Now - Date)
MsgBox "Pointage enregistré", vbInformation
End If
End With
End If
End If
End With
Cancel = True
End Sub
Je vous laisse tester et revenir vers moi le cas échéant.
Cdlt,