Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .CountLarge > 1 Then Exit Sub
If Intersect(Target, [B2:AF13]) Is Nothing Then Exit Sub
Dim T#(1 To 3), chn$, s$, lig&, col As Byte, k As Byte
lig = .Row: Application.ScreenUpdating = 0
For col = 2 To 32
With Cells(lig, col)
chn = .Value: s = Right$(chn, 3)
k = -(s = "HDS") - 2 * (Right$(s, 2) = "JM") - 3 * (Right$(s, 1) = "R")
If k > 0 Then T(k) = T(k) + Val(Replace$(chn, ",", "."))
End With
Next col
If T(1) > 0 Then Cells(lig, 38) = T(1) 'HDS
If T(3) > 0 Then Cells(lig, 39) = T(3) 'R
If T(2) > 0 Then Cells(lig, 44) = T(2) 'JM
End With
End Sub