Error en listbox1
tengo un pequeño error en un listbox que depende de dos combobox
el error es que no me muestra en el listbox si solo encuentra una coicidencia y si existe mas de 2 tampoco no se que puede ser envío código que estoy utilizando, lo otro como agrego otro campo al listbox ya que me aparecen dos y necesito que me aparezcan 3.
Private Sub CommandButton1_Click()
ListBox2.Clear
Dim fecha1 As Date
Dim fecha2 As Date
Do While ComboBox2.Value = "" Or ComboBox3.Value = ""
MsgBox "es obligagorio rellenar los dos combos de fechas"
Exit Sub
Loop
fecha1 = ComboBox2.Value
fecha2 = ComboBox3.Value
Sheets("INFORMES").Activate
Range("e2").Select
Do While ActiveCell.Value <> ""
If ActiveCell.Value = fecha1 Then
Exit Do
Else
ActiveCell.Offset(1, 0).Activate
End If
Loop
Do While ActiveCell.Value <> fecha2
ListBox2.AddItem ActiveCell.Offset(0, -4).Value
c = ListBox2.ListCount - 1
ListBox2.List(c, 1) = ActiveCell.Offset(0, -1).Value
ActiveCell.Offset(1, 0).Activate
Loop
suma2 = suma2 + ActiveCell.Offset(0, -1).Value
For p = 0 To ListBox2.ListCount - 1
suma2 = suma2 + CDbl(ListBox2.List(p, 1))
Next
TextBox2.Value = suma2
TextBox2.Value = Format(TextBox2, "#,##0.00")
End Sub
Private Sub ListBox2_Click()
End Sub
Private Sub UserForm_Initialize()
Sheets("INFORMES").Activate
Range("e1").CurrentRegion.Sort key1:=Range("e1"), order1:=xlAscending, Header:=xlYes, ordercustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("e2").Activate
Do While ActiveCell.Value <> ""
If InStr(valores, ActiveCell) = 0 Then
valores = valores & "," & ActiveCell
End If
ActiveCell.Offset(1, 0).Activate
Loop
valores = Mid(valores, 2, Len(valores) - 1)
valores = Split(valores, ",")
For X = 0 To UBound(valores)
ComboBox2.AddItem valores(X)
ComboBox3.AddItem valores(X)
Next
End Sub
Private Sub CommandButton2_Click()
UserForm37.Hide
End Sub