View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default urgent vba code wanted

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


--
Regards,
Tom Ogilvy

"helmekki " wrote in message
...
Hi all
when i enter an item in the sale report (table in sheet1), i want the
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
hesham


---
Message posted from http://www.ExcelForum.com/