• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Error in Do until statement


I have three values in the excel sheet
B Column contains Opening stock
C Column contains Sold units
D column contains Closing stock

I put the below macro code if the closing is less than or equal to zero the process should stop . But the do until statement is working more than that

>>> You've noted many times <<<
>>> use code - tags <<<
Sub reconcile()
Dim i As Integer
Dim x As Integer
i = Range("D2").Value
x = Range("C2").Value

Do Until i <= 0
'Result = Result + i
x = x - 1
Range("C2").Value = x
If i <= 0 Then
End If

End Sub
Attaching the macro excel sheet need solution


Last edited by a moderator:

Marc L

Excel Ninja
As I can't see any logic within the code so it can be trashed !​
Then according to any Excel forum rules - like for the code tags you have forgotten again ! -​
you must well elaborate with details each step to be achieved …​