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
Bing Bing Search APIs Bing Spell Check API
39 questions
Microsoft 365 and Office Install, redeem, activate For business Windows
Microsoft 365 and Office Excel For business Windows
3,887 questions
Windows for business Windows Client for IT Pros User experience Other
Community Center Not monitored
46,175 questions
Accepted answer
-
Viorel 122.5K Reputation points
2023-10-02T14:30:59.21+00:00