Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi shone try this, the only way i no:
Rightclick on sheet-SUPPLIED-tap select Show Programcode paste this kode in window to the right: Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("C2:C20")) Is Nothing Then Exit Sub If Target = "" Then Exit Sub Dim r, Code, Checknr Checknr = "" Code = Target.Offset(0, -1) If Code = "" Then Target = "": Target.Offset(0, -1).Select: Exit Sub For r = 2 To 20 If Sheets("STOCK").Cells(r, 1) = Code Then Checknr = "ok" Sheets("STOCK").Cells(r, 2) = Sheets("STOCK").Cells(r, 2) + Target.Value End If Next If Checknr = "" Then Target.Select MsgBox ("No match in Database"): Target = "" Sheets("DATABASE").Select End If End Sub and put this in sheet SOLD kode-window Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("C2:C20")) Is Nothing Then Exit Sub If Target = "" Then Exit Sub Dim r, Code, Checknr Checknr = "" Code = Target.Offset(0, -1) If Code = "" Then Target = "": Target.Offset(0, -1).Select: Exit Sub For r = 2 To 20 If Sheets("STOCK").Cells(r, 1) = Code Then Checknr = "ok" Sheets("STOCK").Cells(r, 2) = Sheets("STOCK").Cells(r, 2) - Target.Value End If Next If Checknr = "" Then Target.Select MsgBox ("No match in Database"): Target = "" Sheets("DATABASE").Select End If End Sub The kode check for quantity and if CD-Code nr is in DATABASE best regards. PM |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
order of calculations in Excel | Excel Worksheet Functions | |||
complex calculations | Excel Discussion (Misc queries) | |||
Calculations based on PivotTable information | Excel Discussion (Misc queries) | |||
Calculations crossing multiple sheets | Excel Discussion (Misc queries) | |||
time interval calculations in excel | Excel Discussion (Misc queries) |