Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
Por rit
Posts
#47733
Bom dia,

Alguem tem um código que faça filtro por segmentação e faça uma impressão?

Isso a partir de uma lista, tenho uma segmentação que eu vou selecionando item por item ai ele altera um grafico e eu imprimo.

seria um for I = segmentação.count imprimir. só nao sei como escrever isso da forma correta.
#47739
Veja se ajuda.
Código: Selecionar todos
Option Explicit

Sub Imprimir()
    Dim pvtTable    As PivotTable
    Dim lngSlicers As Long, lngItems        As Long, lngAtual   As Long
    
    Set pvtTable = wshPvt.PivotTables("pvtTeste")
    
    For lngSlicers = 1 To pvtTable.PivotFields("Categoria").PivotItems.Count
        lngAtual = lngAtual + 1
        With ThisWorkbook.SlicerCaches("SegmentaçãodeDados_Categoria")
            .ClearManualFilter
            For lngItems = 1 To pvtTable.PivotFields("Categoria").PivotItems.Count
                If lngAtual = lngItems Then
                    .SlicerItems(lngItems).Selected = True
                Else
                    .SlicerItems(lngItems).Selected = False
                End If
            Next lngItems
            
            wshPvt.PrintOut
        End With
    Next lngSlicers
    
    Set pvtTable = Nothing
End Sub
Você não está autorizado a ver ou baixar esse anexo.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord