Home Excel Powerpoint Word Outlook Error Codes

VBA Useful Codes

Welcome to the World of VBA
Home > VBAUsefulCodes

Create a pivot table using VBA Excel

create a pivot table from MS Excel (2007 version).

Sub PivotTableForExcel2007()

' This code just creates the empty pivot. You need to add pivot filters and fields as required

    Dim SourceRange As Range
    Set SourceRange = Sheets("Sheet1").Range("A3:N13")
    ActiveWorkbook.PivotCaches.Create( _
    SourceType:=xlDatabase, _
    SourceData:=SourceRange, _
    Version:=xlPivotTableVersion12).CreatePivotTable _
    TableDestination:="", _
    TableName:="", _
End Sub


Enter your e-mail below and get notified on the latest blog posts.


VBA Outlook KPI Excel Alt+F11 Dashboards Macros Recording Graphs Automation Developer WaterFall Powerpoint Charts Pivot Tables Forecast Charts

Follow Us