invno = Sheet4.Range("b" & t).ValueDim counta, r As Long
counta = Sheets("InvoiceDatabase").Cells(Rows.count, "B").End(xlUp).Row
countb = Sheets("SalesReceiptDocList").Cells(Rows.count, "C").End(xlUp).Row
t = 3
u = 3
Do While t <= counta
Sheet4.Range("ai" & t).Value = Sheet4.Range("w" & t).Value
invno = Sheet4.Range("b" & t).Value
Do While u <= countb
If Left(Sheet19.Cells(u, 3), 12) = invno Then
paid = Format(Sheet19.Cells(u, "F"), "####0.00") 'Paid
sum = sum + Val(paid)
sum = Format(sum, "#,##0.00")
Sheet4.Range("ai" & t).Value = Val(Sheet4.Range("w" & t).Value) - sum
End If
u = u + 1
Loop
t = t + 1
Loop
End If
End Sub
this code carry INV01,02,03,04,05
but when it loop in second sheet19, why it only run the INV01?
how to make it continue loop INV01,02,03,04,05 in second loop?