Featured Replies
Archivado
Este tema está ahora archivado y está cerrado a más respuestas.
A better way to browse. Learn more.
A full-screen app on your home screen with push notifications, badges and more.
Este tema está ahora archivado y está cerrado a más respuestas.
Buenos dias
Tengo un problema con mi código que no acabo de conseguir realizar que me filtre por los dos datos requeridos.
A continuación explico las partes del código
txt_equipo: se cargan los datos al realizar la búsqueda en el cbo_not, estos datos son iguales que la columna 1 del tabla equipos
cbo_tarea_prin: los datos los recoge de la hoja7 . este combo lo tengo como evento clik , estos datos están en la columna 2 de la tabla equipos
Lo que necesito es que en el cbo_tarea_prin me aparezcan los datos de la columna 2 que concuerden con los de la columna 1 y que después me los muestre en el listbox1.
Espero puedan ayudarme.
Gracias
Private Sub cbo_not_Change()' carga datos en el txt_equipo Dim fila As Integer With Hoja1 If cbo_not.Value = "" Then 'txt_equipo = "" cbo_equipo = "" txt_descrip = "" 'cbo_tareas_prin = "" End If final = Hoja1.Range("A" & Rows.Count).End(xlUp).Row For fila = 2 To final If cbo_not = Hoja1.Cells(fila, 1) Then txt_equipo = Hoja1.Cells(fila, 2) ' cbo_equipo = Hoja1.Cells(fila, 2) txt_descrip = Hoja1.Cells(fila, 5) Exit For End If Next final = Hoja7.Range("a" & Rows.Count).End(xlUp).Row For fila = 2 To final If txt_equipo = Hoja7.Cells(fila, 1) Then 'cbo_tareas_prin = Hoja7.Cells(fila, 2) txt_descrip = Hoja1.Cells(fila, 5) Exit For End If Next End With ' PermisosAsociados 'Tareasequipos ' tiempos End Sub Private Sub cbo_not_Enter() Dim fila As Integer Dim Lista As String For fila = 2 To cbo_not.ListCount cbo_not.RemoveItem 0 Next fila final = Hoja8.Range("A" & Rows.Count).End(xlUp).Row For fila = 2 To final Lista = Hoja1.Cells(fila, 1) cbo_not.AddItem (Lista) Next End Sub Private Sub cbo_tarea_prin_Click()'EN ESTE PUNTO TENGO EL PROBLEMA Dim fila, final As Integer fila = 2 With Hoja7 For fila = 2 To final If cbo_tarea_prin = Hoja7.Cells(fila, 2) Then Exit For End If Next If cbo_tarea_prin.Value = Empty Then ListBox1.Clear End If Me.ListBox1.ColumnCount = 10 Me.ListBox1.ColumnWidths = "30pt;115pt;50pt;50pt;50pt;50pt;50pt;100pt;50pt;50pt" ListBox1.Clear items = Hoja7.Range("equipos").CurrentRegion.Rows.Count For i = 2 To items If LCase(txt_equipo.Value) Like "*" & LCase(cbo_tarea_prin.Value) Then 'LCase(Hoja7.Cells(i, 1).Value) Like "*" & ListBox1.AddItem Hoja7.Cells(i, 3) ListBox1.List(ListBox1.ListCount - 1, 1) = Hoja7.Cells(i, 7) ListBox1.List(ListBox1.ListCount - 1, 2) = Hoja7.Cells(i, 8) ListBox1.List(ListBox1.ListCount - 1, 3) = Hoja7.Cells(i, 9) ListBox1.List(ListBox1.ListCount - 1, 4) = Hoja7.Cells(i, 10) ListBox1.List(ListBox1.ListCount - 1, 5) = Hoja7.Cells(i, 11) ListBox1.List(ListBox1.ListCount - 1, 6) = Hoja7.Cells(i, 12) ListBox1.List(ListBox1.ListCount - 1, 7) = Hoja7.Cells(i, 13) ListBox1.List(ListBox1.ListCount - 1, 8) = Hoja7.Cells(i, 14) ListBox1.List(ListBox1.ListCount - 1, 9) = Hoja7.Cells(i, 15) End If Next i Exit Sub End With End Sub Private Sub cbo_tarea_prin_Enter()' carga los datos en el cbo , tiene el problema que saca registros repetidos Dim fila As Integer Dim Lista As String For fila = 2 To cbo_tarea_prin.ListCount cbo_tarea_prin.RemoveItem 0 Next fila final = Hoja7.Range("b" & Rows.Count).End(xlUp).Row For fila = 2 To final Lista = Hoja7.Cells(fila, 2) cbo_tarea_prin.AddItem (Lista) Next End Sub