Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Buscar un valor en hoja excel y devolver todas las filas con este valor

publicado

Hola, tengo un userform con 2 combobox en el primero cargo un turno y el segundo se llena con los nombres y rut según el turno, lo que quiero ahora es que al seleccionar el nombre se llene un listbox con los datos de la hoja “Materiales” según el rut , el rut se puede repetir muchas veces en el listado y en el listbox debieran aparecer todos los registros

Adjunto lo que tengo hasta ahora

Slds.-

Macros.rar

Featured Replies

publicado

Saludos.

Una pequeña macro, espero te sirva


Private Sub Rut_Change()
'declaramos las variables a utilizar
Dim fm, td As Integer
Dim datos As String
Application.ScreenUpdating = False
'trabajamos en la hoja materiales
With Sheets("Materiales")
'ultima celda con datos
fm = .Range("A65536").End(xlUp).Row
'filtramos en base al rut seleccionado
With .Range("$A$1:$A" & fm)
.AutoFilter Field:=1, Criteria1:=Rut.Value
'determinamos si hay datos visibles
td = .SpecialCells(xlCellTypeVisible).Count
End With
'condicionamos si hay datos o no el que
'continue ejecutandose la macro
If td > 1 Then
'si hay datos creamos una hoja temporal
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = "Temporal"
Else
'si no hay datos avisamos quitamos filtro limpiamos list y salimos
.Range("A1").AutoFilter
Lista1.RowSource = datos
MsgBox "No hay datos que mostrar"
Exit Sub
End If
'copiamos los datos a la hoja temporal
.Range("$A$1:$N" & fm).SpecialCells(xlCellTypeVisible).Copy _
Destination:=Sheets("Temporal").Range("A1")
'determinamos el rango a mostrar en el list
datos = Sheets("Temporal").Range("A1").CurrentRegion.Address
'eliminamos el filtro de la hoja materiales
.Range("A1").AutoFilter
End With
'preparamos y cargamos el list
With Lista1
.ColumnCount = 13
.RowSource = datos
End With
'eliminamos la hoja temporal
Application.DisplayAlerts = False
Sheets("Temporal").Delete
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
[/HTML]

Atte.

joshua

publicado
  • Autor

Excelente amigo joshua muchas gracias

Slds.-

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.