vba code wanted

  • Thread starter Thread starter helmekki
  • Start date Start date
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
 
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top