Try to remove the Exit Sub
line.
I would like for my command to repeat through each row, at the moment it only runs on 1 row
Roberto
20
Reputation points
I have the current VBA
Sub Subtract()
cPart = Sheet3.Range("a2, a1000")
cQty = Sheet3.Range("b2, b1000")
'loop
lastrow = Sheet1.Cells(Rows.Count, 1).End(xlUp).row
For i = 2 To lastrow
If Sheet1.Cells(i, 1) = cPart Then
'found it
Sheet1.Cells(i, 4) = Sheet1.Cells(i, 4) - cQty
Exit Sub
End If
Next i
End Sub
This only runs for 1 row, but I would like for it to repeat through every active row.. Please help
Accepted answer
-
Viorel 118.6K Reputation points
2023-10-02T14:30:59.21+00:00