954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Sum all item on Listview column

Hi all,,

How i can sum all item on listview column.

Thank you in advance.

Jade_me
Light Poster
44 posts since Nov 2007
Reputation Points: 30
Solved Threads: 2
 

See if this helps :
Assuming that the ListView already have a header, so index i start from 1.
If you don't have header then index start from 0.

Private Sub Command1_Click()
Dim temp As Integer
temp = 0
For i = 1 To ListView1.ListItems.Count
    'temp = temp + Val(ListView1.ListItems.Item(i).Text) ' First Column
    temp = temp + Val(ListView1.ListItems(i).SubItems(1)) ' Second Column 
    'temp = temp + Val(ListView1.ListItems(i).SubItems(2)) ' Third Column
Next i
MsgBox temp
End Sub
Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

Thank ypu very much jx.
It's what i looking for.

Jade_me
Light Poster
44 posts since Nov 2007
Reputation Points: 30
Solved Threads: 2
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: