Solved

All the False values in recorded Pivot table

Posted on 2014-02-17
4
334 Views
Last Modified: 2014-02-25
Do I really need all these false values on a pivot table created with the recorder?

    ActiveSheet.PivotTables("PivotTable10").AddDataField ActiveSheet.PivotTables( _
        "PivotTable10").PivotFields("Oper. Qty"), "Sum of Oper. Qty", xlSum
    Range("B6").Select
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Order Number").Subtotals _
        = Array(False, False, False, False, False, False, False, False, False, False, False, False _
        )
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Category  ").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("CAT_ORD").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Loc   ").Subtotals = Array _
        (False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Product ").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields( _
        "Product Short Description               ").Subtotals = Array(False, False, False _
        , False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Basic Matl").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Resource        "). _
        Subtotals = Array(False, False, False, False, False, False, False, False, False, False, _
        False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields( _
        "Short Description               ").Subtotals = Array(False, False, False, False, _
        False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Start Date").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Start Time").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("PlanShip St").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Del Plant Desc"). _
        Subtotals = Array(False, False, False, False, False, False, False, False, False, False, _
        False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Usage").Subtotals = Array( _
        False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("MAXMadDate").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("End Date  ").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("RecMADDate").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Reason Cd").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Msg Text").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Seat Color 1").Subtotals _
        = Array(False, False, False, False, False, False, False, False, False, False, False, False _
        )
    ActiveSheet.PivotTables("PivotTable10").PivotFields("End Time").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("TimeZone").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Oper. Qty").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("  Op.Duratn").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("  Op.Duratn2").Subtotals _
        = Array(False, False, False, False, False, False, False, False, False, False, False, False _
        )
    ActiveSheet.PivotTables("PivotTable10").PivotFields("   RemOpDur").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Dealloc.").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Released").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Fixed").Subtotals = Array( _
        False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Started").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Part.Conf.").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("Final Con.").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("PegReqOrNo").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("SO").Subtotals = Array( _
        False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("SOLN").Subtotals = Array( _
        False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").PivotFields("SOSOLN").Subtotals = Array _
        (False, False, False, False, False, False, False, False, False, False, False, False)
    ActiveSheet.PivotTables("PivotTable10").RowAxisLayout xlTabularRow

Open in new window

0
Comment
Question by:RWayneH
  • 2
4 Comments
 
LVL 12

Expert Comment

by:Harry Lee
ID: 39866218
RWayneH,

Do you mind to upload your data and pivot table? It's extremely hard to read these codes like this.

You probably don't need all these, but I need to take a look in the actual data to tell.
0
 
LVL 80

Accepted Solution

by:
byundt earned 500 total points
ID: 39866232
Yes, you need all the False, but you can simplify your code to this:
Sub PT()
Dim pf As Variant
With ActiveSheet.PivotTables("PivotTable10")
    .AddDataField .PivotFields("Oper. Qty"), "Sum of Oper. Qty", xlSum
    
    For Each pf In Array("Order Number", "Category  ", "CAT_ORD", "Loc   ", "Product ", "Product Short Description               ", _
            "Basic Matl", "Resource        ", "Short Description               ", "Start Date", "Start Time", "PlanShip St", _
            "Del Plant Desc", "Usage", "MAXMadDate", "End Date  ", "RecMADDate", "Reason Cd", "Msg Text", "Seat Color 1", _
            "End Time", "TimeZone", "Oper. Qty", "  Op.Duratn", "  Op.Duratn2", "   RemOpDur", "Dealloc.", "Released", _
            "Fixed", "Started", "Part.Conf.", "Final Con.", "PegReqOrNo", "SO", "SOLN", "SOSOLN")
        .PivotFields(pf).Subtotals = Array(False, False, False, False, False, False, False, False, False, False, False, False)
    Next
    .RowAxisLayout xlTabularRow
End With
End Sub

Open in new window

0
 
LVL 12

Expert Comment

by:Harry Lee
ID: 39866237
Good eye Brad!

The code makes me feel dizzy.
0
 

Author Closing Comment

by:RWayneH
ID: 39887665
EXCELlent -R-
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now