vba code wanted

H

helmekki

Hi
when i enter an item in the sale report (table in shhet1), i want th
same item quantity deducted form a list in sheet2 in the same workbook
i have trying so far................
Could you please provide me with a vba code does this jo
 
H

Harald Staff

Hi

Sure. Rightclick the sheet tab of shhet1, choose View Code, paste this in:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If IsNumeric(Target.Value) Then _
Sheets("Sheet2").Range("A1").Value = _
Sheets("Sheet2").Range("A1").Value - Target.Value
End Sub

Now any number you enter in a cell in shhet1 will be deducted from the value
in Sheet1 A1. (Note that you can't undo it.)

HTH. Best wishes Harald
 
D

Don Guillett

As usual, you should show us your efforts for comments. You can do this with
a worksheet_change event, finding the target on the other sheet and having
the offseted value less than before by the amount entered in the target
cell.
 
Top