refilling data in same cell after user input in another cell
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "D2" '<== change to suit
On Error GoTo ws_exit
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Range("B5") = Range("B5") - .Value
.Value = ""
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
"H. Singh" wrote:
How can I reduce the value in a cell by certain number which I enter in
another cell.
eg: operator enters value 3 in cell D2 and press enter - I want the value
say 55 in cell B5 to be reduced by 3 and have 3 from D2 to be cleared and 55
becomes 52 in B5.
--
H. Singh
|