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.

Como hago un filtro en vba para seleccionar rangos de fecha

publicado

Saludos:


Encontré un código para realizar un filtro, que adapte a mi proyecto. El filtro selecciona completamente las filas que coinciden con el criterio. El criterio es dado por dos combobox fechainicio y fechafin. El filtro es muy rápido, encuentra las coincidencias con el criterio y selecciona la fila con Entirerow.select. Todo funciona bien, pero necesito que en lugar de agregar a la seleccion toda la fila, agregue la celda que esté en la columna F.

La estructura de la hoja es:
codigo    area    sub area    descripcion    mes

El proyecto tiene dos combobox: cmbInicio, cmbFin y un boton: Button

El código

Private Sub Button_Click()
    Mes = "Enero, Febrero, Marzo, Abril, Mayo, Junio, Julio, Agosto, Septiembre, Octubre, Noviembre, Diciembre"
    If cmbInicio.ListIndex > cmbFin.ListIndex Then aux = cmbInicio.ListIndex: cmbInicio.ListIndex = cmbFin.ListIndex: cmbFin.ListIndex = aux
    Sheets("Datos").Select
    a = cmbInicio.ListIndex + 1: b = cmbFin.ListIndex + 1
    For i = a To b
        criterio = criterio & Split(mes, ",")(i - 1) & ","
    Next i
    criterio = Mid(criterio, 1, Len(criterio) - 1)
    criterio = Split(criterio, ",")
    Range("E:E").AutoFilter field:=1, Criteria1:=criterio, Operator:=xlFilterValues
    Range("E2").Select
    ActiveCell.Offset(1, 0).Select
    If Cells(Columns("E").Rows.Count, "E").End(xlUp).Row > 1 Then
        Range(Selection, Cells(Columns("E").Rows.Count, "E").End(xlUp)).SpecialCells(xlCellTypeVisible).EntireRow.Select
    End If
    Selection.AutoFilter
    Application.ScreenUpdating = True
End Sub

 

esta es la línea hace la selección

Range(Selection, Cells(Columns("E").Rows.Count, "E").End(xlUp)).SpecialCells(xlCellTypeVisible).EntireRow.Select

 

 

 

filtro.rar

Featured Replies

publicado
Cita

Todo funciona bien, pero necesito que en lugar de agregar a la selección toda la fila, agregue la celda que esté en la columna F.

Hola @seba64, necesito preguntarte, con agregar la celda de la columna F, ¿aque te refieres específicamente? Saludos!!!

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.