Q
QuietMan
I'm using th code below, is this the most efficient way to use the array?
Sub Load_PivotFields()
Dim DataFieldArray As Variant, Pivot_Field As String, Sht_Select As String
Application.ScreenUpdating = False
Sheets("Formulas").Select
DataFieldArray = Range(Cells(100, 1), Cells(147, 8)).Value
For w = 1 To 8
ActiveSheet.Next.Select
Sht_Select = ActiveSheet.Name
For x = 1 To UBound(DataFieldArray)
Pivot_Field = DataFieldArray(x, w)
ActiveSheet.PivotTables("PivotTable1").AddDataField
ActiveSheet.PivotTables("PivotTable1").PivotFields(Pivot_Field), "Sum of " &
Pivot_Field, xlSum
Nex x
Next w
Application.ScreenUpdating = True
End Sub
Sub Load_PivotFields()
Dim DataFieldArray As Variant, Pivot_Field As String, Sht_Select As String
Application.ScreenUpdating = False
Sheets("Formulas").Select
DataFieldArray = Range(Cells(100, 1), Cells(147, 8)).Value
For w = 1 To 8
ActiveSheet.Next.Select
Sht_Select = ActiveSheet.Name
For x = 1 To UBound(DataFieldArray)
Pivot_Field = DataFieldArray(x, w)
ActiveSheet.PivotTables("PivotTable1").AddDataField
ActiveSheet.PivotTables("PivotTable1").PivotFields(Pivot_Field), "Sum of " &
Pivot_Field, xlSum
Nex x
Next w
Application.ScreenUpdating = True
End Sub