|
-
April 8th, 1999, 12:04 AM
#1
list box calculations
Please, I need to know how to total numeric values in a list box and divide that by the list count.
-
April 8th, 1999, 02:24 AM
#2
Re: list box calculations
let's assume that your listbox contains only numbers:
dim iSum as integer
Dim i as integer
For i = 0 To List1.ListCount - 1
isum = isum + List1.List(i)
Next i
MsgBox isum / List1.ListCount
-
April 8th, 1999, 02:29 AM
#3
Re: list box calculations
Hi
Try something like :
Dim lTot As Long
Dim lCount As Long
For lCount = 0 To List1.ListCount - 1
If IsNumeric(List1.List(lCount)) Then
lTot = lTot + CLng(List1.List(Count))
End If
Next
MsgBox "Total = " & lTot
MsgBox "Average = " & lTot / List1.ListCount
Regards
Chris Eastwood
CodeGuru - the website for developers
http://www.codeguru.com/vb
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|