Bonjour,
une proposition :
Sub EssaiInput()
Dim iVar As Variant, Ok As Boolean, LeRep As String, TabSep() As String, Modif As Boolean
If ActiveSheet.Range("A1") = "" Then
Modif = True
Else
Rep = MsgBox("Ce matricule est déjà associé à cette feuille :" & ActiveSheet.Range("J1").Value & Chr(13) & Chr(10) & "Vous voulez modifier le matricule ?", vbYesNo + vbQuestion, "Excel")
If Rep = vbYes Then
Modif = True
End If
End If
If Modif Then
Do
iVar = InputBox("Entrez le numéro de votre matricule :", "Excel")
If StrPtr(iVar) = 0 Then
Exit Sub
ElseIf iVar = vbNullString Or iVar = 0 Then
MsgBox "Veuillez saisir un matricule valide svp.", vbOKOnly + vbCritical, "Excel"
ElseIf Not IsNumeric(iVar) Then
MsgBox "Veuillez saisir un nombre svp.", vbCritical + vbOKOnly, "Excel"
Else
Ok = True
ActiveSheet.Range("A1").Value = iVar
End If
Loop While Not Ok
End If
End Sub
Je mets en commun la demande de matricule et avant je test s'il faut lancer cette demande.
@ bientôt
LouReeD