Format the Pivot Table based on its value

     

     

    Sub Conditional_Formatting_On_Single_Item_based_on_Item_Value()
    InputSH
    Define_PivotTable
    PV.PivotSelect "Apple", xlDataOnly, True
    MsgBox Selection.Count
    For Numb = 1 To Selection.Count - 1
    If Selection(Numb) > 500 Then
    Selection(Numb).Font.ColorIndex = 5
    Selection(Numb).Font.Bold = True
    End If
    Next
    End Sub


    Sub Conditional_Formatting_On_EntireField_Items()
    InputSH
    Define_PivotTable
    PV.PivotSelect "Item", xlDataOnly, True
    MsgBox Selection.Count
    NumberOfColumns = Selection.Columns.Count
    For Numb = 1 To Selection.Count - NumberOfColumns
    'MsgBox Selection(Numb)
    If Selection(Numb) > 500 Then
    Selection(Numb).Font.ColorIndex = 5
    Selection(Numb).Font.Bold = 5
    End If
    Next
    End Sub


    Sub Change_the_Color_Based_On_Row_Label()
    InputSH
    Define_PivotTable
    For i = 1 To PV.PivotFields("Location").PivotItems.Count
    'MsgBox PV.PivotFields("Location").PivotItems(i).Name
    If PV.PivotFields("Location").PivotItems(i).Name = "Chennai" Or _
    PV.PivotFields("Location").PivotItems(i).Name = "Pune" Then
    LocationName = PV.PivotFields("Location").PivotItems(i).Name
    PV.PivotSelect LocationName, xlDataAndLabel, True
    Selection.Font.ColorIndex = 5
    Selection.Font.Bold = True
    End If
    Next
    End Sub

     

    Download The Workbook