Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://excel-egy.com/forum/f33
- -------------------------------
- Private Sub Worksheet_Change(ByVal Target As Range)
- Dim v As Double, x As Double, c As Long
- If Target.CountLarge > 1 Then Exit Sub
- If Target.Column = 8 Then
- Application.ScreenUpdating = False
- v = Val(Target.Value)
- If v > 0 Then
- For c = 7 To 1 Step -1
- If v - Cells(Target.Row, c) >= 0 Then
- v = v - Cells(Target.Row, c)
- x = x + Cells(Target.Row, c)
- Cells(Target.Row, c) = 0
- End If
- If v = 0 Or c = 1 Then Target.Value = Target.Value - x: Exit For
- Next c
- End If
- Application.ScreenUpdating = True
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement