Thread Locked. Code not wrapped
I need help with the VBA I got. Below is my spreadsheet. I basically want Column B updated autmatically when I put numbers on Column C and D. Below that is the code that needs editing/adding. Right now, Column C is working but not for Column D. Please help. Thnx.
(Spreadsheet):
A1: Item Name B1: Current Balance C1: Daily Usage (-) D1: Restock (+)
A2: Item Alpha B2:45 C2:______ D2:______
A3: item Bravo B3: 120 C3:______ D3: ______
(VBA):
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "C8:C24" '
On Error GoTo ws_exit
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If IsNumeric(.Value) Then
If IsNumeric(.Offset(0, -1).Value) Then
.Offset(0, -1).Value = .Offset(0, -1).Value - .Value
.Value = ""
End If
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
I hope my request is clear enough. Thanks in advance for your replies.
Bookmarks