Hi,
I need a little help with my code. I have a pivot table report that I created and I added some code to it change the background color of the PivotFields. The beginning of the code works, but the last bit of code does not work. I have provided samples below of the code that works and the one that doesn't.
This piece of code works fine:
Range("D9").Select
ActiveSheet.PivotTables("rptInterest").PivotFields("Location")
.Caption = "SUPSHIP"
Selection.Font.Bold = True
Selection.Font.ColorIndex = 35
Selection.Interior.ColorIndex = 56
This piece of code DOES NOT work fine:
Range("E9:" & LastColumn).Select
ActiveSheet.PivotTables("rptInterest").PivotFields ("Year")
Selection.Font.Bold = True
Selection.Font.ColorIndex = 35
Selection.Interior.ColorIndex = 56
What I want the last piece of code to is change the font and background cell color to the ones I have chosen for the pivot field "Year". In cell E9 the field title is 2010, E10: 2011, E11:2012, etc...I want these changes to take hold to the very last year in the pivot table.
I need a little help with my code. I have a pivot table report that I created and I added some code to it change the background color of the PivotFields. The beginning of the code works, but the last bit of code does not work. I have provided samples below of the code that works and the one that doesn't.
This piece of code works fine:
Range("D9").Select
ActiveSheet.PivotTables("rptInterest").PivotFields("Location")
.Caption = "SUPSHIP"
Selection.Font.Bold = True
Selection.Font.ColorIndex = 35
Selection.Interior.ColorIndex = 56
This piece of code DOES NOT work fine:
Range("E9:" & LastColumn).Select
ActiveSheet.PivotTables("rptInterest").PivotFields ("Year")
Selection.Font.Bold = True
Selection.Font.ColorIndex = 35
Selection.Interior.ColorIndex = 56
What I want the last piece of code to is change the font and background cell color to the ones I have chosen for the pivot field "Year". In cell E9 the field title is 2010, E10: 2011, E11:2012, etc...I want these changes to take hold to the very last year in the pivot table.