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.

Macro para relacionar un filtro de tabla dinamica con una celda

publicado

Tengo una tabla dinámica y quiero que se actualice el filtro por el valor puesto en una celda.

Ya busque codigos que hagan esto y si existen, el problema es que mi tabla viene de PowerPivot y estos codigos no funcionan

Al hacer una macro el sistema tira el siguiente codigo:

ActiveSheet.PivotTables("Detalle_Cuentas").PivotFields( _
        "[Cuenta_Externa].[N_extendido].[N_extendido]").ClearAllFilters -(hasta aquí funciona bien)-
   

ActiveSheet.PivotTables("Detalle_Cuentas").PivotFields( _
        "[Cuenta_Externa].[N_extendido].[N_extendido]").CurrentPage = _
        "[Cuenta_Externa].[N_extendido].&[(05-002) Mano de Obra Directa]"
(Esta es la parte que quiero sustituir por un valor ubicado en la celda ("AA1"))

En Internet encontre este codigo que ha de funcionar si la tabla dinamica es creada con un conjunto de datos de Excel

Private Sub Worksheet_Change(ByVal Target As Range)
 
If Not Intersect(Target, Range("AA1")) Is Nothing Then
 
    'En base al campo Region de la Tabla dinámica1:
    With PivotTables("Detalle_Cuentas").PivotFields("N_extendido")
     
        'Limpiar todos los filtros
        .ClearAllFilters
         
        'Filtrar por el valor de la celda F1
        On Error Resume Next
        .CurrentPage = Range("AA1").Value
         
    End With
End If
 
End Sub

pero Por tratarse de una tabla creada en PowerPivot este codigo me tira el siguiente mensaje de error "No se puede obtener la propiedad PivotFields de la clase PivotTable"

¿Alguien podrá ayudarme?

 

Featured Replies

No hay posts para mostrar

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.