can I create a pivot table directly from a database without having to export it into excel? YES or NO if Yes then how ?
Printable View
can I create a pivot table directly from a database without having to export it into excel? YES or NO if Yes then how ?
Yes. Do a search for Cross-Tab query in your database's help file.
.XL.Sheets(1).PivotTableWizard SourceType:=1, SourceData:="'" & .XL.Sheets(1).Name _
& "'!R1C1:R" & a + 1 & "C9", TableDestination:="", TableName:="PivotTable1"
.XL.Sheets(1).PivotTables("PivotTable1").AddFields RowFields:=Array("SECTION_ID"), _
ColumnFields:="FN_ENDING_DATE"
what changes should I make in this code to use a database as the source and the result of a query as the data source ?
because here the data being used is in an excel file and the data range is also known...help!!!