AnnieM
02-05-2017, 03:24 AM
Hi All,
I have a ListBox (lstBox1) on a userform that contains 12 items ("1" - "12")
Each of these items is related to a TextBox on the form ("TextQty1" - "TextQty12")
I am trying to get the sum of the corresponding values of "TextQty" selected from the ListBox items so that I can use this total in a sub elsewhere on the form. I am thinking something like:
Total = 0
If ListIndex0.Selected Then Total = Total + TextQty1.Value
If ListIndex1.Selected Then Total = Total + TextQty2.Value
But I really don't know how to structure this or if there is a better way, so can anyone please offer some advice?
Thanks in advance,
Anne
I have a ListBox (lstBox1) on a userform that contains 12 items ("1" - "12")
Each of these items is related to a TextBox on the form ("TextQty1" - "TextQty12")
I am trying to get the sum of the corresponding values of "TextQty" selected from the ListBox items so that I can use this total in a sub elsewhere on the form. I am thinking something like:
Total = 0
If ListIndex0.Selected Then Total = Total + TextQty1.Value
If ListIndex1.Selected Then Total = Total + TextQty2.Value
But I really don't know how to structure this or if there is a better way, so can anyone please offer some advice?
Thanks in advance,
Anne