Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim Ligne As Long, Cel As Range, Couleur As Integer
Select Case UCase(Sh.Name)
Case "LISTE_PRATICIENS" ', "MODÈLE 3", "MODÈLE 4"
Case Else
If Target.Count > 1 Then Exit Sub
If Target.Count > 1 Or Target.Row < 3 Then Exit Sub 'Cette ligne de macro pour pouvoir taper ou coller du texte dans la ligne N°2
Longlet = ActiveSheet.Name
RevenirOuJetais = Target.Cells.Address
If Not Intersect(Target, Range("B3:B8")) Is Nothing Then Call AfficherLesLignesNecessaires
ActiveSheet.Range(RevenirOuJetais).Select
Application.EnableEvents = False
If Not Intersect(Sh.Range("B10:B" & Rows.Count), Target) Is Nothing Then
Sh.Range("A" & Target.Row) = IIf(Target = "", "", Application.Proper(Format(Date, "dddd dd mmmm yyyy")))
If Target = "" Then
Couleur = Target.Offset(-1, -1).Interior.ColorIndex
Ligne = Target.Row
While Left(Sh.Range("A" & Ligne), 5) <> "Série"
Ligne = Ligne - 1
Wend
Set Cel = Sh.Range("A3:A8").Find(what:=Sh.Range("A" & Ligne), LookIn:=xlValues, lookat:=xlWhole)
If Not Cel Is Nothing Then
Couleur = Cel.Interior.ColorIndex
End If
' Sh.Unprotect
With Target.Offset(0, -1).Resize(1, 10)
.ClearContents
.Interior.ColorIndex = Couleur
End With
' Sh.Protect 'UserInterfaceOnly:=True
End If
ElseIf Not Intersect(Sh.Range("I10:I" & Rows.Count), Target) Is Nothing And Target = "" Then
Target.NumberFormat = "#,##0.00 $"
ElseIf Target.Column = 1 Then
If IsDate(Target) Then
Target = Application.Proper(Format(Target, "dddd dd mmmm yyyy")) ' Sinon on inscrit la date
Else
Target = ""
End If
End If
Application.EnableEvents = True
End Select
End Sub