Consulting

Results 1 to 2 of 2

Thread: Automatically Printing Autofilters / loop through all filter values then print vba

  1. #1

    Question Automatically Printing Autofilters / loop through all filter values then print vba

    Hello,
    I need macro or VBA code to print all data in the table based on # column like filter 1 then print then filter 2 and print etc
    can anyone help, please1.jpg2.jpg3.jpg

  2. #2
    i try this macro but it didn't work
    Sub Macro1()
    '
    ' Macro1 Macro
    '
    
    '
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("#")
            .PivotItems("2").Visible = False
            .PivotItems("3").Visible = False
            .PivotItems("4").Visible = False
            .PivotItems("5").Visible = False
            .PivotItems("6").Visible = False
            .PivotItems("7").Visible = False
            .PivotItems("#N/A").Visible = False
            .PivotItems("(blank)").Visible = False
        End With
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
            IgnorePrintAreas:=False
        Range("A3").Select
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("#")
            .PivotItems("1").Visible = False
            .PivotItems("2").Visible = True
        End With
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
            IgnorePrintAreas:=False
        ActiveSheet.PivotTables("PivotTable1").PivotSelect "'#'[All]", xlLabelOnly, _
            True
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("#")
            .PivotItems("2").Visible = False
            .PivotItems("3").Visible = True
        End With
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
            IgnorePrintAreas:=False
        Range("A3").Select
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("#")
            .PivotItems("3").Visible = False
            .PivotItems("4").Visible = True
        End With
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
            IgnorePrintAreas:=False
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("#")
            .PivotItems("4").Visible = False
            .PivotItems("5").Visible = True
        End With
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
            IgnorePrintAreas:=False
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("#")
            .PivotItems("5").Visible = False
            .PivotItems("6").Visible = True
        End With
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
            IgnorePrintAreas:=False
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("#")
            .PivotItems("6").Visible = False
            .PivotItems("7").Visible = True
        End With
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
            IgnorePrintAreas:=False EndSub

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •