?
Solved

All the False values in recorded Pivot table

Posted on 2014-02-17
4
Medium Priority
?
354 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 81

Accepted Solution

by:
byundt earned 2000 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

777 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