Filtrar con date time picker y sumar columnas
Para Dante Amor
¿Hola Dan como estas?
Sabes que tengo el código que me ayudaste en un tema anterior para filtrar y sumar columnas
El tema se llama "Mostrar solo únicos al filtrar en textbox y sumar valores de otra columna "
Y ahora lo estoy aplicando para filtrar con un date time picker pero no me suma las columnas que quiero...
Ej
Tengo dos códigos iguales en la columna A y en la columna B dos lotes iguales
Y con el date time picker filtro pero no me suma la columna 6 del listbox...
Es lo mismo que en el tema que me ayudaste anteriormente ...
Me ayudas por favor he intentado arreglarlo pero no puedo...
Este es el código que ocupo en el date time picker
Private Sub DTPicker1_Change()
Application.ScreenUpdating = False
On Error Resume Next
lbltotal = ""
ListBox1.Clear
ListBox1.ColumnCount = 8
ListBox1.ColumnWidths = "60;200;60;90;90;120;90;90"
If DTPicker1.Value < Hoja4.Range("M2") Then
MsgBox ("No existen registros antes de la fecha Seleccionada")
lbltotal = ""
Else
' For celda = 2 To Hoja4.Range("D" & Rows.Count).End(xlUp).Row
For Each celda In Hoja4.Range("D2:D" & Hoja4.Range("D" & Rows.Count).End(xlUp).Row)
If Hoja4.Cells(celda.Row, "G") <> 0 Then
'
If celda >= Hoja4.Range("M2").Value And celda <= DTPicker1 Then
existe = False
For j = 0 To ListBox1.ListCount - 1
If (ListBox1.List(j)) Then vmate = CDbl(ListBox1.List(j)) Else vmate = ListBox1.List(j)
If (ListBox1.List(j, 3)) Then vlote = CDbl(ListBox1.List(j, 3)) Else vlote = ListBox1.List(j, 3)
'
If vmate = Hoja4.Cells(celda, "A") And vlote = Hoja4.Cells(celda, "B") Then
ListBox1.List(j, 6) = Format(CDbl(ListBox1.List(j, 6)) + Hoja4.Cells(celda, "G"), "#0.00")
existe = True
Exit For
End If
Next
If existe = False Then agregarfecha celda, Hoja4
End If
End If
Next
End If
End Sub
'
Sub agregarfecha(celda, Hoja4)
ListBox1. AddItem
ListBox1. List(ListBox1.ListCount - 1, 0) = Hoja4. Cells(celda.Row, "A")
ListBox1. List(ListBox1.ListCount - 1, 1) = Hoja4. Cells(celda.Row, "H")
ListBox1. List(ListBox1.ListCount - 1, 2) = Hoja4. Cells(celda.Row, "I")
ListBox1. List(ListBox1.ListCount - 1, 3) = Hoja4. Cells(celda.Row, "B")
ListBox1. List(ListBox1.ListCount - 1, 4) = Format(Hoja4. Cells(celda. Row, "D"), "DD-MM-YYYY")
ListBox1. List(ListBox1.ListCount - 1, 5) = Format(Hoja4. Cells(celda.Row, "J"), "MM-DD-YY")
ListBox1.List(ListBox1.ListCount - 1, 6) = Format(Hoja4.Cells(celda.Row, "G"), "##.00")
ListBox1.List(ListBox1.ListCount - 1, 7) = Hoja4.Cells(celda.Row, "L")
End Sub'
1 Respuesta
Respuesta de Dante Amor
1
