> Let's say clients accounts come in every week and there
> were 10 sales which would equal 10 rows and 12 items of
> sales accros ( 12 columns) The code would look for the
> highest number down and across and add rows/colums accordingly.
I reread this part of your e-mail a few times and realized you were asking
for a total for a column of numerals (I think?). This is pretty easy once
you know what column you want to work with. This example uses Row 1. There
are other ways to format the value. Search the LR for "format" and you will
see several options, including $. I left the other two examples for the
heck of it:
PushButton Action event:
Dim i, theRowCount, theGrandTotal as Integer
theRowCount = ListBox1.ListCount - 1
For i = 0 to theRowCount
theGrandTotal = theGrandTotal + val(ListBox1.Cell(i, 1))
Next
EditField3.Text = Format(theGrandTotal, "#")
___________________________________________________
It sounds like you're also wanting to check cells for data and do something
with that data once it's found. The following is a small start to that.
Demonstration purposes only and it only indicates where the data you are
looking for was last found.
This presents the last row and column where the data was found. You could
easily format the text to display all of the rows and columns where the data
is found by appending the i and k strings together.
PushButton Action event:
Dim i,k, theCellCount, theColumnCount as Integer
theCellCount = (ListBox1.ListCount - 1) * (ListBox1.ColumnCount - 1)
theColumnCount = ListBox1.ColumnCount - 1
for i = 0 to theCellCount
For k = 0 to theColumnCount
If ListBox1.Cell(i, k) = "Hello" then
EditField1.Text = Str(i)
EditField2.Text = Str(k)
End If
Next
Next
This presents the last row and column where the data was found.
To find the cell(s) with the highest value, this would be a start:
PushButton Action event:
Dim i,k, theCellCount, theColumnCount, highestValue as Integer
theCellCount = (ListBox1.ListCount - 1) * (ListBox1.ColumnCount - 1)
theColumnCount = ListBox1.ColumnCount - 1
for i = 0 to theCellCount
For k = 0 to theColumnCount
If highestValue < val(ListBox1.Cell(i, k)) then
highestValue = val(ListBox1.Cell(i, k))
EditField1.Text = Str(i)
EditField2.Text = Str(k)
End If
Next
Next
EditField3.Text = Str(highestValue)
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|