+ Reply to Thread
Results 1 to 8 of 8

ListView Sum Total

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    440

    ListView Sum Total

    Hi,

    I wonder if anyone know how to sum the total of the value in a listview (not listbox). I can have the total value in a textbox.

    I have tried:

    Please Login or Register  to view this content.
    If anyone can help?

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: ListView Sum Total

    If your subitem content is value then

    Please Login or Register  to view this content.
    If the subitem contains formatted numbers such as £1,234.56 then you will need to strip characters

    You can try this in the immediate window
    Please Login or Register  to view this content.
    Alternatively you could sum the values from the cells as you populuate the listview rather than reading from the listview control
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    440

    Re: ListView Sum Total

    Yeah i had to remove the .Text. But however, how can I sum the total for i listitems?

    Please Login or Register  to view this content.
    This code does not make sense to me.

  4. #4
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    440

    Re: ListView Sum Total

    I found the way to sum it.. Thanks.

  5. #5
    Registered User
    Join Date
    07-17-2014
    Location
    Turkey
    MS-Off Ver
    2003
    Posts
    85

    Re: ListView Sum Total

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    440

    Re: ListView Sum Total

    I have another concern. The result is shown as per ur textgrade.text (lets say a textbox).
    I have a button to delete some listing.. How can make that same textbox refresh the new total after deleting those listing?

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: ListView Sum Total

    After the code deletes the lines you need to run that code again to recalculate total.

    If you put the code in a function you can use 1 set of code in many places.

    Please Login or Register  to view this content.
    The to make use of it you can use

    Please Login or Register  to view this content.
    And the line above can be put in your code any time you finish adding, deleting or editing items in the listview.

  8. #8
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    440

    Re: ListView Sum Total

    Nice!! Thank you very much for the help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. ListView Question
    By calvinle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-31-2014, 12:09 AM
  2. [SOLVED] ListView Mod!
    By ciapul12 in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 01-24-2014, 10:20 AM
  3. [SOLVED] ListView syntax help.
    By tradinup2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2013, 05:13 PM
  4. Listview
    By Sergio Sora in forum Non English Excel
    Replies: 0
    Last Post: 06-26-2012, 07:52 AM
  5. Listview checked row delete line in Listview and in worksheet data
    By madforit in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2012, 01:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1