Bonjour,
met à jour C sur saisie en A ou B :
Private Sub Worksheet_Change(ByVal Target As Range)
'"Bonjour, vous avez payé X, il vous reste encore à payer Y".
Dim pl As Range, c As Range, s1 As String, s2 As String
Set pl = Intersect(Target, [A:B])
If Not pl Is Nothing Then
If Not Intersect(Target, [A:B]) Is Nothing Then
For Each c In Intersect(pl.EntireRow, [A:A])
If IsNumeric(c) And IsNumeric(c.Offset(, 1)) And c <> "" And c.Offset(, 1) <> "" Then
s1 = Format(c, "0.00")
s2 = Format(c.Offset(, 1), "0.00")
Application.EnableEvents = False
c.Offset(, 2) = "Bonjour, vous avez payé " & s1 & ", il vous reste encore à payer " & s2
Application.EnableEvents = True
With c.Offset(, 2).Characters(Start:=25, Length:=Len(s1)).Font
.FontStyle = "Gras"
.Color = vbRed
End With
With c.Offset(, 2).Characters(Start:=Len(c.Offset(, 2).Value) - Len(s2) + 1, Length:=Len(s2)).Font
.FontStyle = "Gras"
.Color = vbRed
End With
End If
Next c
End If
End If
End Sub
à mettre dans le module de la feuille.
eric
Edit 12:50 : correction code