I am trying to SUM a column in a list box and I’ve used the following and other iterations but none will give an answer other than zero. There are several examples of how to add rows but I cannot find code examples on how to add a row of numbers to provide a total. If someone could provide an example or provide a reference I would appreciate it. Many of the references that I have followed have turned out to be non-existent any longer so I ask for your help. Thank you.
Dim i as integer
Dim total as integer
For i=0 to PurchasesLB.ListCount-1
if PurchasesLB.Selected(i) then
total=total+Val(PurchasesLB.Cell(i, 4))
End if
Next
txtTotal.text = format(total, “###,###,##0.00”)
5 posts - 4 participants