PDA

View Full Version : Excel 2000 macros



17-06-1999, 12:05 PM
I have the following section of a macro to create a Pivot table and want to use the CurrentRegion as the SourceData reference instead of the Name 'Database'. How do I do this?

ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:='Database' _
, TableDestination:='', TableName:='PivotTable2'
ActiveSheet.PivotTables('PivotTable2').AddFields RowFields:=Array('T', _
'Subject')
With ActiveSheet.PivotTables('PivotTable2').PivotFields ('Dur')
.Orientation = xlDataField
.Function = xlSum
End With