urgent vba code wanted

H

helmekki

Hi all
when i enter an item in the sale report (table in sheet1), i want th
same item quantity deducted form a list in sheet2 in the same workbook
i have been trying so far................but.

Could you please provide me with a vba code does this job


yours
hesha
 
T

Tushar Mehta

Ummm...I am more than a little confused. A report, by definition,
reports on the state of something. How does it get used to update a
database?

In any case, what have you tried so far? How has it not worked?

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
T

Tom Ogilvy

Using the change event in Sheet1 with code similar to this might be a start.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng as Range, rng1 as Range
Dim res as Variant
if Target.column = 2 Then
With Worksheets("Sheet2")
set rng = .Range(.Cells(1,1),.Cells(1,1).end(xldown))
End with
res = Application.match(target.offset(0,-1),rng,0)
if not iserror(res) then
set rng1 = rng(res)
rng1.offset(0,1).Value = rng1.Offset(0,1).Value - Target.Value
end if
End if
End Sub
 
Top