Necesito sumar dos columnas de un listbox en dos Textbox y ...
Matilde necesito que me ayude a resolver este problema, Necesito hacer dos Textbox en ese List box y que las columnas en ellos aparezcan: Textbox1 la suma de la columna R y en Textbox2 la suma de la columna V. Ahí envío el código(en listbox se copian valores de una hoja a otra hoja y de esa 2 necesito esa suma de que te hable)
Muchas Gracias
Eusebio.
Private Sub CommandButton1_Click()
Dim lItem As Long, LbRows As Long, LbCols As Long
Dim bu As Boolean
Dim Lbloop As Long, Lbcopy As Long
LbRows = ListBox1.ListCount - 1
LbCols = ListBox1.ColumnCount - 1
For lItem = 0 To LbRows
If ListBox1.Selected(lItem) = True Then
bu = True
Exit For
End If
Next
If bu = True Then
With Sheets("MaterialienKopie").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
For lItem = 0 To LbRows
If ListBox1.Selected(lItem) = True Then 'Row selected
'Increment variable for row transfer range
Lbcopy = Lbcopy + 1
For Lbloop = 0 To LbCols
'Transfer selected row to relevant row of transfer range
.Cells(Lbcopy, Lbloop + 1) = ListBox1.List(lItem, Lbloop)
Next Lbloop
End If
Next
For M = 0 To LbCols
With Sheets("MaterialienKopie").Cells(Rows.Count, 1).End(xlUp).Offset(0, M).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = 23
End With
Next
End With
Else
MsgBox "nichts ausgewählt", vbCritical
Exit Sub
End If
MsgBox "Die ausgewählten Daten würden kopiert.", vbInformation
Sheets("MaterialienKopie").Select
End Sub
Private Sub UserForm_Initialize()
Sheets("Materialien").Activate
ligne = Range("A" & Rows.Count).End(xlUp).Row
Me.ListBox1.RowSource = "A2:v" & ligne
Label29.Caption = Sheets("MaterialienKopie").Range("W1")
Label29 = Format(Label29, " ##,###0.00 € ")
Dim lngMyHandle As Long, lngCurrentStyle As Long, lngNewStyle As Long