Buscar por fechas en listbox y filtra datos en textbox
Dante.
Buenas tardes, dentro de este código que esta en el botón de "Buscar por fecha" quiero que se puedan filtrar los datos en los textbox. Envío el código y la imagen para explicarme mejor. Gracias
Private Sub CommandButton1_Click()
ListBox1. Clear
ListBox1.ColumnCount = 10
ListBox1.ColumnWidths = "30;100;135;38;38;38;38;55;115;40;"
For Each celda In Hoja4.Range("I2:I" & Hoja4.Range("I" & Rows.Count).End(xlUp).Row)
If celda >= DTPicker1 And celda <= DTPicker2 Then
ListBox1. AddItem
ListBox1. List(ListBox1.ListCount - 1, 0) = Hoja4. Cells(celda.Row, "A") 'documento
ListBox1. List(ListBox1.ListCount - 1, 1) = Hoja4. Cells(celda.Row, "B") 'nombre
ListBox1. List(ListBox1.ListCount - 1, 2) = Hoja4. Cells(celda.Row, "C") 'articulo
ListBox1. List(ListBox1.ListCount - 1, 3) = Hoja4. Cells(celda.Row, "D") 'saldos ant
ListBox1. List(ListBox1.ListCount - 1, 4) = Hoja4. Cells(celda.Row, "E") 'abono
ListBox1. List(ListBox1.ListCount - 1, 5) = Hoja4. Cells(celda.Row, "F") 'saldo a
ListBox1. List(ListBox1.ListCount - 1, 6) = Hoja4. Cells(celda.Row, "G") 'mora
ListBox1. List(ListBox1.ListCount - 1, 7) = Hoja4. Cells(celda. Row, "H") 'forma
ListBox1.List(ListBox1.ListCount - 1, 8) = Hoja4.Cells(celda.Row, "I") & (" ") & Hoja4.Cells(celda.Row, "J") 'fecha y hora
ListBox1.List(ListBox1.ListCount - 1, 9) = Hoja4.Cells(celda.Row, "K") 'usuario
End If
Next
TextBox5.Value = Me.ListBox1.ListCount
'
Dim total, mora, pago As Long
Dim varRow As Integer
For varRow = 0 To (ListBox1.ListCount - 1)
pago = pago + Val(ListBox1.Column(4, varRow))
mora = mora + Val(ListBox1.Column(6, varRow))
Next
TextBox2 = pago
TextBox3 = mora
On Error Resume Next
pago = Val(TextBox2.Value)
mora = Val(TextBox3.Value)
total = pago + mora
TextBox4.Text = total
On Error GoTo 0
'MsgBox "La Busqueda ha Finalizado.", vbInformation, "Atencion Usuario!!!"
End Sub