Results 1 to 1 of 1

Pivot Table Not Capturing All Of The Data

Threaded View

  1. #1
    Registered User
    Join Date
    06-11-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 365
    Posts
    85

    Pivot Table Not Capturing All Of The Data

    Every week I receive a new M.I. which I insert into the tab names "Brookstreet M.I", and run the macro below. When running the macro with this weeks data the pivot table appeared to miss out a lot of the data.

    I think I may have to adjust my recorded PT macro to capture all data from the M.I. I have included the entire macro below. Can someone please offer some advice?

    Thank You

    Harry

    Sub berINFO()
    '
    ' berINFO Macro
    ' Macro recorded 18/07/2013 by ajn58q
    '
    
    'Application.Calculation = xlCalculationManual
    
        ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
            "'Brookstreet M.I'!R1C1:R979C18").CreatePivotTable TableDestination:="", _
            TableName:="PivotTable1", DefaultVersion:=xlPivotTableVersion10
        ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
        ActiveSheet.Cells(3, 1).Select
        ActiveWorkbook.ShowPivotTableFieldList = True
        ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
            "PivotTable1").PivotFields("Invoice Line Value"), "Sum of Invoice Line Value", _
            xlSum
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("Name")
            .Orientation = xlRowField
            .Position = 1
        End With
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("Invoice No")
            .Orientation = xlRowField
            .Position = 2
        End With
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("Item")
            .Orientation = xlRowField
            .Position = 3
        End With
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("Order No")
            .Orientation = xlRowField
            .Position = 4
        End With
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("Week Ending Date")
            .Orientation = xlRowField
            .Position = 5
        End With
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("JobTitle")
            .Orientation = xlRowField
            .Position = 6
        End With
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("StartDate")
            .Orientation = xlRowField
            .Position = 7
        End With
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("Charge Rate")
            .Orientation = xlRowField
            .Position = 8
        End With
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("Hours")
            .Orientation = xlRowField
            .Position = 9
        End With
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("Comments")
            .Orientation = xlRowField
            .Position = 10
        End With
        ActiveWorkbook.ShowPivotTableFieldList = False
        ActiveCell.Offset(2, 11).Range("A1").Select
        ActiveCell.FormulaR1C1 = _
            "=INDEX('Purchase Order Number'!C[-11],MATCH(C[-8],'Purchase Order Number'!C[-11],0))"
        ActiveCell.Select
        Selection.AutoFill Destination:=ActiveCell.Range("A1:A9630"), Type:= _
            xlFillDefault
        ActiveCell.Range("A1:A9630").Select
        ActiveWindow.LargeScroll Down:=-17
        ActiveCell.Offset(0, 1).Range("A1").Select
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(C[-9],'Purchase Order Number'!C[-12]:'Purchase Order Number'!C[-7],6,FALSE)"
        ActiveCell.Select
        Selection.AutoFill Destination:=ActiveCell.Range("A1:A9630"), Type:= _
            xlFillDefault
        ActiveCell.Range("A1:A9630").Select
        ActiveCell.Offset(0, 1).Range("A1").Select
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(C[-10],'Purchase Order Number'!C[-13]:'Purchase Order Number'!C[-10],4,FALSE)"
        ActiveCell.Select
        Selection.AutoFill Destination:=ActiveCell.Range("A1:A9630"), Type:= _
            xlFillDefault
        ActiveCell.Range("A1:A9630").Select
        ActiveCell.Offset(-1, 0).Range("A1").Select
        Selection.AutoFilter
        ActiveWindow.ScrollColumn = 2
        ActiveWindow.ScrollColumn = 3
        ActiveCell.Offset(-1, -2).Range("A1").Select
        Selection.AutoFilter Field:=12, Criteria1:="<>#N/A", Operator:=xlAnd
        Selection.AutoFilter Field:=13, Criteria1:="<>#N/A", Operator:=xlAnd
        Selection.AutoFilter Field:=14, Criteria1:="<>#N/A", Operator:=xlAnd
        ActiveCell.Columns("A:A").EntireColumn.Select
        Selection.EntireColumn.Hidden = True
        ActiveCell.Offset(3, 1).Range("A1").Select
        ActiveCell.Columns("A:A").EntireColumn.EntireColumn.AutoFit
        ActiveCell.Select
        Selection.Borders(xlDiagonalDown).LineStyle = xlNone
        Selection.Borders(xlDiagonalUp).LineStyle = xlNone
        With Selection.Borders(xlEdgeLeft)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = 1
        End With
        Selection.Borders(xlEdgeTop).LineStyle = xlNone
        Selection.Borders(xlEdgeBottom).LineStyle = xlNone
        Selection.Borders(xlEdgeRight).LineStyle = xlNone
        Selection.Borders(xlInsideVertical).LineStyle = xlNone
        Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
        ActiveCell.FormulaR1C1 = "Cluster"
        ActiveCell.Offset(0, 1).Range("A1").Select
        Selection.Interior.ColorIndex = xlNone
        Selection.Borders(xlDiagonalDown).LineStyle = xlNone
        Selection.Borders(xlDiagonalUp).LineStyle = xlNone
        With Selection.Borders(xlEdgeLeft)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = 1
        End With
        Selection.Borders(xlEdgeTop).LineStyle = xlNone
        Selection.Borders(xlEdgeBottom).LineStyle = xlNone
        Selection.Borders(xlEdgeRight).LineStyle = xlNone
        Selection.Borders(xlInsideVertical).LineStyle = xlNone
        Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
        ActiveCell.FormulaR1C1 = "BER"
        ActiveCell.Offset(0, -1).Range("A1:B9451").Select
        Selection.Borders(xlDiagonalDown).LineStyle = xlNone
        Selection.Borders(xlDiagonalUp).LineStyle = xlNone
        With Selection.Borders(xlEdgeLeft)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With Selection.Borders(xlEdgeTop)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With Selection.Borders(xlEdgeBottom)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With Selection.Borders(xlEdgeRight)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With Selection.Borders(xlInsideVertical)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        Application.Calculation = xlCalculationAutomatic
        Application.ScreenUpdating = False
    
       
    
    
    End Sub
    Last edited by arlu1201; 07-24-2013 at 01:31 PM. Reason: Use

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Capturing data from another table
    By rayzorkat in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-03-2013, 09:59 AM
  2. Capturing web data table from a dynamic web address
    By niteshsanghai in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-15-2012, 08:09 AM
  3. [SOLVED] NamedRange Source is not capturing all the data in Pivot Table
    By JieJenn in forum Excel General
    Replies: 2
    Last Post: 04-04-2012, 03:50 PM
  4. Replies: 1
    Last Post: 06-22-2010, 09:10 AM
  5. Capturing data without pivot table
    By Megan in forum Excel General
    Replies: 2
    Last Post: 01-27-2005, 10:40 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1