H
helmekki
Hello All
My problem is :
This code works fine, but when i place the ordered Qyt in the invoic
sheet (E19.....E49),
the qyt should be reduced from the quantities range (D32
1800) in th
stock sheet..........
Ths problem, the reduction is placed one row below the row that contai
the qyts ordered
i donot know why i tested the code line by line............but
pls, any help would be appreciated....see the attache
file................
the code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim OrdVal As Long
Dim strOrd As String
Dim lrow As Long
Dim rngStock As Range
Dim myCheck As Integer
On Error GoTo err
If Application.Intersect(Target, Range("C19:C49")) Is Nothing Then
'Exit Sub
Else
OrdVal = Target.Value
strOrd = Target.Offset(0, 2).Value
myCheck = MsgBox("" & OrdVal & " Units of " & strOrd & " were ordered"
vbYesNo)
If myCheck = vbNo Then
Exit Sub
End If
lrow = Application.Match(strOrd, Sheet3.Range("C1:C1800"), 0)
Set rngStock = Sheet3.Range("C1").Offset(lrow, 1)
rngStock.Value = rngStock.Value - OrdVal
End If
Set rngStock = Nothing
err: Exit Sub
End Sub
yours
hesha
My problem is :
This code works fine, but when i place the ordered Qyt in the invoic
sheet (E19.....E49),
the qyt should be reduced from the quantities range (D32

stock sheet..........
Ths problem, the reduction is placed one row below the row that contai
the qyts ordered
i donot know why i tested the code line by line............but
pls, any help would be appreciated....see the attache
file................
the code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim OrdVal As Long
Dim strOrd As String
Dim lrow As Long
Dim rngStock As Range
Dim myCheck As Integer
On Error GoTo err
If Application.Intersect(Target, Range("C19:C49")) Is Nothing Then
'Exit Sub
Else
OrdVal = Target.Value
strOrd = Target.Offset(0, 2).Value
myCheck = MsgBox("" & OrdVal & " Units of " & strOrd & " were ordered"
vbYesNo)
If myCheck = vbNo Then
Exit Sub
End If
lrow = Application.Match(strOrd, Sheet3.Range("C1:C1800"), 0)
Set rngStock = Sheet3.Range("C1").Offset(lrow, 1)
rngStock.Value = rngStock.Value - OrdVal
End If
Set rngStock = Nothing
err: Exit Sub
End Sub
yours
hesha