• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Özet Tablo Ayarları ile ilgili

Katılım
22 Mayıs 2007
Mesajlar
178
Excel Vers. ve Dili
2016 English
Özet tablo oluştuktan sonra

Subtotal için "do not show subtotal"

Grand Total İçin "off for rows and colums"

repor layout için ise "show in tabular form" ve "repeat all item labels" kısımlarının

ayarlanacağı bir macro yapmak mümkünmü.

Her defasında bu ayarları yapmak benim için işkence oluyor.

Yardımlarınız için çok teşşekür ederim.
 
Kod:
Sub PT_Duzenle_Tek_PT()

    Dim pt As PivotTable
    Dim pf As PivotField

    Set pt = Worksheets("Sheet1").PivotTables("PivotTable3")

    On Error Resume Next

    With pt
        .RowGrand = False
        .ColumnGrand = False
        .RowAxisLayout xlTabularRow
        For Each pf In pt.PivotFields
                pf.Subtotals(1) = True
                pf.Subtotals(1) = False
                pf.RepeatLabels = True
        Next pf
    End With

End Sub



Kod:
Sub PT_Duzenle_Tum_Sayfa_PT()

    Dim pt As PivotTable
    Dim pf As PivotField
    Dim ws As Worksheet

    Set ws = Worksheets("Sheet1")

    On Error Resume Next

    For Each pt In ws.PivotTables
        With pt
            .RowGrand = False
            .ColumnGrand = False
            .RowAxisLayout xlTabularRow
            For Each pf In pt.PivotFields
                    pf.Subtotals(1) = True
                    pf.Subtotals(1) = False
                    pf.RepeatLabels = True
            Next pf
        End With
    Next pt

End Sub



Kod:
Sub PT_Duzenle_Tum_Kitap_PT()

    Dim pt As PivotTable
    Dim pf As PivotField
    Dim ws As Worksheet

    On Error Resume Next

    For Each ws In Worksheets
        For Each pt In ws.PivotTables
            With pt
                .RowGrand = False
                .ColumnGrand = False
                .RowAxisLayout xlTabularRow
                For Each pf In pt.PivotFields
                        pf.Subtotals(1) = True
                        pf.Subtotals(1) = False
                        pf.RepeatLabels = True
                Next pf
            End With
        Next pt
    Next ws

End Sub
 
Eline emeğinize aklınıza sağlık.
Tüm Kitap için yazdığınız kodda pivot tableın stun genişliğini ayarlayabilirmisniz..

Saygılarımla.
 
rica ederim.

sütun genişliğini pivot tablodan değil de normal worksheet üzerinden olabilir.

For Each ws In Worksheets
dedikten sonra...

ws.UsedRange.EntireColumn.AutoFit
eklenebilir.
 
Elinize sağlık ekleyince olmadı hiç ama hiç önemli değil.

Sonsuz Saygılarımla.
 
rica ederim.

tabii autofit için o sayfanın seçili (aktif) olması gerekiyor.

bir de şöyle deneyelim:
Kod:
Sub PT_Duzenle_Tum_Kitap_PT()

    Dim pt As PivotTable
    Dim pf As PivotField
    Dim ws As Worksheet

    On Error Resume Next

    For Each ws In Worksheets
[COLOR="Red"]        ws.Select[/COLOR]
        For Each pt In ws.PivotTables
            With pt
                .RowGrand = False
                .ColumnGrand = False
                .RowAxisLayout xlTabularRow
                For Each pf In pt.PivotFields
                        pf.Subtotals(1) = True
                        pf.Subtotals(1) = False
                        pf.RepeatLabels = True
                Next pf
            End With
        Next pt
[COLOR="red"]        ws.UsedRange.EntireColumn.AutoFit[/COLOR]
'veya alternatif olarak...
'[COLOR="red"]        ws.Cells.EntireColumn.AutoFit[/COLOR]
    Next ws

End Sub
 
Son düzenleme:
Geri
Üst