Hi, I’m running into a problem with the following code. Column 1 is correctly summed. However, the summed total of Column2 is the combined total of Column 1 and Column 2. I can’t see why the total of Column 1 is rolling over into Column 2. I’d greatly appreciate it if someone could tell me what I;ve done wrong, or what is missing.
Thank you
// Column 1
Dim i As Integer
Dim total As Double
For i=0 To ExpensesLB.LastRowIndex
total=total+Val(ExpensesLB.Cell(i, 1))
Next
txtTotal.Text = Format(total, “###,###,##0.00”)
ExpensesLB.Cell(44,1) = txtTotal.text
ExpensesLB.CellAlignmentAt(44,1) = ListBox.Alignments.Right
// Column2
For i=0 To ExpensesLB.LastRowIndex
total=total+Val(ExpensesLB.Cell(i, 2))
Next
txtTotal.Text = Format(total, “###,###,##0.00”)
ExpensesLB.Cell(44,2) = txtTotal.text
ExpensesLB.CellAlignmentAt(44,2) = ListBox.Alignments.Right
4 posts - 3 participants