Problema con listbox
Publicado por Marvin (19 intervenciones) el 05/06/2018 01:09:13
Buen dia.
Tengo un problema, podrian por favor ayudarme.
Tengo una hoja de la que extraigo al inicio con un listbox todas las columnas
que son 15 y funciona correctamente, el parametro ColumnCount es 15 en las propiedades del listbox.
Pero cuando filtro en otro proceso a traves de una de las columnas que es fecha solo me regresa 10 columnas.
Probablemenente no ha entendido el concepto, aqui la muestra del filtro
Este el codigo del filtro
Podria por favor alguien indicarme donde esta mi error.
Gracias de antemano
Tengo un problema, podrian por favor ayudarme.
Tengo una hoja de la que extraigo al inicio con un listbox todas las columnas
que son 15 y funciona correctamente, el parametro ColumnCount es 15 en las propiedades del listbox.
1
2
3
4
5
Me.ListBox1.RowSource = ("A1:O1") & Worksheets("CITAS").Range("A" & Rows.Count).End(xlUp).Row
With Me.ListBox1
.ColumnCount = 15
.ColumnWidths = "75 pt;40 pt;70 pt;200 pt;200 pt;100 pt; 100 pt; 250 pt; 300 pt; 300 pt; 300 pt; 75 pt; 100 pt; 100 pt; 100 pt"
End With
Pero cuando filtro en otro proceso a traves de una de las columnas que es fecha solo me regresa 10 columnas.
Probablemenente no ha entendido el concepto, aqui la muestra del filtro
Este el codigo del filtro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Set b = Sheets("CITAS")
uf = b.Range("A" & Rows.Count).End(xlUp).Row
dato1 = CDate(TextBox2)
dato2 = CDate(TextBox3)
' Asignando las fechas de ingreso a texto para impresion
fecha_inicio = dato1
fecha_final = dato2
' Control sobre los datos ingresados
If dato2 = Empty Or dato1 = emtpy Then
MsgBox ("DEBE INGRESAR UN RANGO DE FECHAS PARA CONSULTAR O EXPORTAR LAS CITAS"), vbCritical, "REPORTE DE CITAS"
Exit Sub
End If
If dato2 < dato1 Then
MsgBox ("LA FECHA FINAL NO PUEDE SER MAYOR A LA FECHA INICIAL"), vbCritical, "REPORTE DE CITAS"
Exit Sub
End If
' Limpiando el filtro
b.AutoFilterMode = False
Me.ListBox1 = Clear
Me.ListBox1.RowSource = Clear
' Ciclo para carga de datos
For i = 2 To uf
' Asignando-convirtiendo la fecha de la base de datos para comparar
dato0 = CDate(b.Cells(i, 1).Value)
' Verificando que el dato se encuentre dentro del rango
If dato0 >= dato1 And dato0 <= dato2 Then
Me.ListBox1.AddItem b.Cells(i, 1)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) = b.Cells(i, 2)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 2) = b.Cells(i, 3)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 3) = b.Cells(i, 4)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 4) = b.Cells(i, 5)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 5) = b.Cells(i, 6)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 6) = b.Cells(i, 7)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 7) = b.Cells(i, 8)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 8) = b.Cells(i, 9)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 9) = b.Cells(i, 10)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 10) = b.Cells(i, 11)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 11) = b.Cells(i, 12)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 12) = b.Cells(i, 13)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 13) = b.Cells(i, 14)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 14) = b.Cells(i, 15)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 15) = b.Cells(i, 16)
End If
Next i
' Tamano de las columnas
Me.ListBox1.ColumnWidths = "75 pt;40 pt;70 pt;200 pt;200 pt;100 pt; 100 pt; 250 pt; 300 pt; 300 pt; 300 pt; 75 pt; 100 pt; 100 pt; 100 pt"
Podria por favor alguien indicarme donde esta mi error.
Gracias de antemano
Valora esta pregunta
0