Hello all, I'm looking for a little help with the PivotSelect command in a macro I am trying to write. I am still new at writing macros, so thank you for your help on this. My goal is that if the Pivot Field "Nbr" contains any of the numbers in the String "Y", it will highlight it yellow. Here is my macro so far that is not working, however I know that I am close.
Sub Highlight_Row() Dim PI As PivotItem Dim Y As String Y = 4175, 1780, 5535, 1123 For Each PI In Worksheets("Service").PivotTables("PivotTable1").PivotFields("Nbr").PivotItems If PI = Y Then ActiveSheet.PivotTables("PivotTable3").PivotSelect " 'Y' ", xlDataAndLabel, True With Selection.Interior .ColorIndex = 36 .Pattern = xlSolid End With End If Next PI End Sub