Ich möchte in einer Listbox in einer UserForm die Werte waagrecht und auch senkrecht zusammenzählen und die Summe in einem Label anzeigen lassen.
Wie würde hier bitte eine VBA Lösung lauten ?
Danke
Josef
Private SummeListBox()
Dim x As Long, y As Long
Dim erg As Double
For x = 0 To ListBox1.ColumnCount - 1
For y = 0 To ListBox1.ListCount - 1
erg = erg + ListBox1.List(x, y)
Next y
Next x
Label1.Caption = erg
End Sub
Gruß,Private Sub SummeListBox()
heißen ;-)Private Sub SummeListBox()
Label1.Caption = Application.Sum(ListBox1.List)
End Sub
Gruß,Private Sub CommandButton18_Click()
Dim iX As Integer
Dim dSumme As Double
For iX = 0 To ListBox14.ListCount - 1
dSumme = dSumme + Val(Replace(ListBox14.List(iX, 0), ",", "."))
Next iX
Label179.Caption = Format(dSumme, "#0.00")
Dim iY As Integer
Dim dSumme1 As Double
For iY = 0 To ListBox14.ListCount - 1
dSumme1 = dSumme1 + Val(Replace(ListBox14.List(iY, 1), ",", "."))
Next iY
Label180.Caption = Format(dSumme1, "#0.00")
End Sub