hello
I have two sheets the sheet sale is invoice and sheet the result is stock so what I'm trying subtracting the quantity in sheet result from sheet sale the quantity in sheet sale is column f and in sheet result in column e it should match in sheet sale in column C,D,E with sheet result B,C,D then subtract quantity from sheet sale in column f to sheet result in column e
this is my trying but not work
the data in sheet sale
sheet result
I have two sheets the sheet sale is invoice and sheet the result is stock so what I'm trying subtracting the quantity in sheet result from sheet sale the quantity in sheet sale is column f and in sheet result in column e it should match in sheet sale in column C,D,E with sheet result B,C,D then subtract quantity from sheet sale in column f to sheet result in column e
this is my trying but not work
VBA Code:
Sub nn()
Dim sh1, sh2 As Worksheet
Dim rngFound As Range
Set sh1 = Worksheets("sale").Columns(6)
Set sh2 = Worksheets("result")
With sh2.Columns(1)
Set rngFound = .Find(Cells(sh1.Row, 3).Value)
If Not rngFound Is Nothing Then
rngFound(1, 5).Value = rngFound(1, 5).Value - sh1.Value
End If
End With
End Sub
item | brand | type | origin | quantity | unit |
1 | tune | 180wg | thi | 11 | 3.00 |
2 | oil | 2l | indo | 2 | 5.00 |
sheet result
item | brand | type | origin | quantity |
1 | tune | 180wg | thi | 234 |
2 | oil | 2l | indo | 123 |