1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim Credit As Double, Debit As Double
Application.EnableEvents = False
If Target.Column <> 6 Then Exit Sub
Debit = Cells(Target.Row, "C")
Credit = Cells(Target.Row, "D")
If Target = "X" Then
Target = ""
[G2] = [G2] - Credit + Debit
Else
If Cells(Target.Row, "B") <> "" Then
Target = "X"
[G2] = [G2] + Credit - Debit
End If
End If
Target.Offset(1, 0).Activate
Application.EnableEvents = True
End Sub |
Partager