Get Balance of an entry

  • Thread starter Thread starter helmekki
  • Start date Start date
H

helmekki

Hi there

I am trying to get the balance of one entry ,...................but
???
i.e. Db side must equal Cr side of one entry, otherwise
the difference should appear in the next column


Code:
--------------------
Sub testbal()
Dim Db As Currency
Dim Cr As Currency
Dim v3 As Currency
Dim entryN As Long
Dim i As Long

With Range("bon")
entryN = .Cells(1, 1)
While .Cells(1, 1) = entryN
For i = 2 To 20
Db = .Cells(i, 4)
Cr = .Cells(i, 5)
If Db <> Cr Then
v3 = Db - Cr
.Cells(i, 6) = v3
End If
Db = 0
Cr = 0
entryN = .Cells(i, 1)
Next i
Wend
End With
End Sub
 
not sure exactly what you sheet looks like, but i get it to run if i get rid
of the period before the cells() entries
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top