How can summarize item in a listview

I have the following 2 field in a grid
GroupField   TotalField
AAA            1
BBB            1
CCC            1
AAA            1
BBB            2
CCC            1
AAA            1
BBB            1
Now i need to provide a summary in a listview as follows

GroupField   TotalField
AAA             3
BBB            4
CCC            2

I have done the following

Private sub SetupListview

      with lvw.ColumnHeaders
          .Add, "Grp","Group,2000
            .Add, "Ttl","Total,2000
      end with
end sub

Private sub PopulateListView(Byval strGroup as string,intValue as integer)
      dim li as listItem
        dim liKey as string

liKey="k" & StrGroup
      if lvw.listitems.count > 0 Then

            for each li in lvw.listitems
                  if li.text=strGroup then
                        li.subItems(1)=IntValue + 1
                        SET LI=LVW.ListItems.Add(,likey,strGroup)
                  end if
            SET LI=LVW.ListItems.Add(,likey,strGroup)
      end if

end sub
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shiju SasidharanAssoc Project ManagerCommented:
try this

Private Sub PopulateListView(ByVal strGroup As String, intValue As Integer)
Dim lst As ListItem
     Set lst = lvw.FindItem(strGroup, lvwText, , lvwWhole)
     If lst Is Nothing Then
         Set lst = lvw.ListItems.Add(, , strGroup)
            lst.SubItems(1) = intValue
        lst.SubItems(1) = CInt(lst.SubItems(1)) + intValue
     End If
     Set lst = Nothing
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gabriel_BrienzaAuthor Commented:
fantastic .it worked very well
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.