Hi all, below is a code I use to add a quantity to a "Sales" sheet from a matching name on a "Purchase" sheet. What I need to know is how do I get it to not do it if the cell in column M of the "Sales" sheet is > ("0")
Hope you can help as I'm a novice with vba.
Thanks in Advance
Code:
Sub Match()
Dim NextRw As Long
Dim rCl As Range
Dim Rw As Long
Dim Amt As Long
Dim sFind As String
Dim ws As Worksheet
Set ws = Worksheets("Sales")
With Range("Purchases")
For Rw = 1 To .Rows.Count
sFind = .Cells(Rw, 1).Text ' Name
Amt = .Cells(Rw, 4).Value 'Quantity
With ws.Range("D1", ws.Cells(Rows.Count, "D").End(xlUp))
Set rCl = .Find(sFind, LookIn:=xlValues, lookat:=xlWhole)
On Error Resume Next
rCl.Offset(0, 2).Value = Amt
End With
Next Rw
End With
End Sub
Hope you can help as I'm a novice with vba.
Thanks in Advance