• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Cumulatively sum values in Listbox [SOLVED]

NeilCruz

New Member
Hi All,

I'm Neil and new to VBA, I have attached a worksheet similar to my work. In this worksheet, I have a 3 column ListBox with RecordID, Description & NetWeight values on it.
Below the ListBox, I have 2 textbox to be populated with Counter and the Cummulative Net Weight, respectively. In my code the Counter seems to be correct, but my cumulative weight was adding up wrong. Can anyone help me to give the correct code. Here is the part of code below...

'Count and Sum of Net Weigths
wSum = "0"
wList = ListBox1.List(ListBox1.ListCount - 1, 2)
ListBox1.ListIndex = xList
For xList = 0 To (ListBox1.ListCount - 1)
wSum = Val(wSum) + Val(wList)
TextBox4.Value = wSum
TextBox3.Value = xList + 1 'Counter of entries
Next xList
 

Attachments

  • Shipping.xlsm
    60.8 KB · Views: 39
Back
Top