How to create pivot table using vba code
Sub CreatePivotTable()
Dim pc As PivotCache
Dim pt As PivotTable
Dim pf As PivotField
Set pc = ThisWorkbook.PivotCaches.Create(xlDatabase, SourceData:=Sheet1.Name & "!" & Sheet1.Range("A1").CurrentRegion.Address, Version:=xlPivotTableVersion15)
Worksheets.Add
Range("A1").Select
Set pt = pc.CreatePivotTable(TableDestination:=ActiveCell, TableName:="Emp Report")
Set pf = pt.PivotFields("Product")
pf.Orientation = xlRowField
Set pf = pt.PivotFields("Region")
pf.Orientation = xlColumnField
Set pf = pt.PivotFields("Name")
pf.Orientation = xlDataField
ActiveSheet.PivotTables("Emp Report").NullString = 0
End Sub
En esta página del sitio puede ver el video en línea How to create pivot table using vba code de Duración hora minuto segunda en buena calidad , que subió el usuario VBA Learning tutorials 20 mayo 2020, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 186 veces y le gustó 4 a los espectadores. Disfruta viendo!