I have to check a number of pivot tables to ensure that the Data fields are "Sum" and not "Count". I have the following code for 1 such pivot table but feel that it can be shortened, any advice would be appreciated with Thanks in advance.
Worksheets("First_Pivot").Select
If Left(Range("B10").Value, 5) = "Count" Then
ActiveSheet.PivotTables("Finances").PivotFields("Count of Mth Act").Function _
= xlSum
End If
If Left(Range("C10").Value, 5) = "Count" Then
ActiveSheet.PivotTables("Finances").PivotFields("Count of Mth Bud").Function _
= xlSum
End If
If Left(Range("D10").Value, 5) = "Count" Then
ActiveSheet.PivotTables("Finances").PivotFields("Count of Mth Var").Function _
= xlSum
End If
If Left(Range("E10").Value, 5) = "Count" Then
ActiveSheet.PivotTables("Finances").PivotFields("Count of YTD Act").Function _
= xlSum
End If
If Left(Range("F10").Value, 5) = "Count" Then
ActiveSheet.PivotTables("Finances").PivotFields("Count of YTD Bud").Function _
= xlSum
End If
If Left(Range("G10").Value, 5) = "Count" Then
ActiveSheet.PivotTables("Finances").PivotFields("Count of YTD Var").Function _
= xlSum
End If
If Left(Range("H10").Value, 5) = "Count" Then
ActiveSheet.PivotTables("Finances").PivotFields("Count of FY Fcast").Function _
= xlSum
End If
If Left(Range("I10").Value, 5) = "Count" Then
ActiveSheet.PivotTables("Finances").PivotFields("Count of FY Bud").Function _
= xlSum
End If
Worksheets("First_Pivot").Select
If Left(Range("B10").Value, 5) = "Count" Then
ActiveSheet.PivotTables("Finances").PivotFields("Count of Mth Act").Function _
= xlSum
End If
If Left(Range("C10").Value, 5) = "Count" Then
ActiveSheet.PivotTables("Finances").PivotFields("Count of Mth Bud").Function _
= xlSum
End If
If Left(Range("D10").Value, 5) = "Count" Then
ActiveSheet.PivotTables("Finances").PivotFields("Count of Mth Var").Function _
= xlSum
End If
If Left(Range("E10").Value, 5) = "Count" Then
ActiveSheet.PivotTables("Finances").PivotFields("Count of YTD Act").Function _
= xlSum
End If
If Left(Range("F10").Value, 5) = "Count" Then
ActiveSheet.PivotTables("Finances").PivotFields("Count of YTD Bud").Function _
= xlSum
End If
If Left(Range("G10").Value, 5) = "Count" Then
ActiveSheet.PivotTables("Finances").PivotFields("Count of YTD Var").Function _
= xlSum
End If
If Left(Range("H10").Value, 5) = "Count" Then
ActiveSheet.PivotTables("Finances").PivotFields("Count of FY Fcast").Function _
= xlSum
End If
If Left(Range("I10").Value, 5) = "Count" Then
ActiveSheet.PivotTables("Finances").PivotFields("Count of FY Bud").Function _
= xlSum
End If