Dim Ligne As Long, Colonne As Long, Col As Long
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("g3:j71")) Is Nothing Then
Ligne = Target.Row: Colonne = Target.Column: Col = 11
If Target.Value = "" And WorksheetFunction.CountA(Range(Cells(Ligne, "G"), Cells(Ligne, "J"))) = 0 Then Cells(Ligne, "K").Value = "": Exit Sub
If UCase(Target.Value) <> "X" Then Exit Sub
If Colonne = 9 Or Colonne = 10 Then
Inscription_Nom
ElseIf (Colonne = 7 Or Colonne = 8) And WorksheetFunction.CountA(Cells(Ligne, "I"), Cells(Ligne, "J")) = 0 Then
Inscription_Nom
End If
ElseIf Not Application.Intersect(Target, Range("l3:o71")) Is Nothing Then
Ligne = Target.Row: Colonne = Target.Column: Col = 16
If Target.Value = "" And WorksheetFunction.CountA(Range(Cells(Ligne, "L"), Cells(Ligne, "O"))) = 0 Then Cells(Ligne, "P").Value = "": Exit Sub
If UCase(Target.Value) <> "X" Then Exit Sub
If Colonne = 14 Or Colonne = 15 Then
Inscription_Nom
ElseIf (Colonne = 12 Or Colonne = 13) And WorksheetFunction.CountA(Cells(Ligne, "L"), Cells(Ligne, "O")) = 0 Then
Inscription_Nom
End If
End If
End Sub
Private Sub Inscription_Nom()
Dim Utilisateur As String
If InStr(Application.UserName, "-") = 0 Then
Utilisateur = Application.UserName
Else:
Utilisateur = Left(Application.UserName, 1) & Mid(Application.UserName, InStr(Application.UserName, "-") + 1, 2)
End If
Cells(Ligne, Col).Value = Utilisateur
End Sub