Hi All,
Hope one of you can help me out...
I have an Excel 2007 workbook that has some pivot tables in it and as we are all aware, the formatting from the source data does not carry over into the pivot table and even if you manage to reformat the data in the pivot table it gets whacked every time the pivot table is changes...
So, in my workbook, I have a macro that goes through and updates my pivot table data format when invoked. It works fine. However, I also want to be able to update the font colors of the data values in the pivot table based on the font color of the underlying source data. Can any of you throw me a fish on how I can loop through the source data and the pivot table data values to do this?
My current macro is below as a reference.
I also took a look at some code written by Mike Alexander at datapig that is pretty cool and gets me part way there, but it only takes me to the column level and I havn't been able to figure out how to modify it to my needs. See http://datapigtechnologies.com/blog...tch-source-data/comment-page-1/#comment-20916
Any insight will be greatly appreciated.
thanks,
rick
Hope one of you can help me out...
I have an Excel 2007 workbook that has some pivot tables in it and as we are all aware, the formatting from the source data does not carry over into the pivot table and even if you manage to reformat the data in the pivot table it gets whacked every time the pivot table is changes...
So, in my workbook, I have a macro that goes through and updates my pivot table data format when invoked. It works fine. However, I also want to be able to update the font colors of the data values in the pivot table based on the font color of the underlying source data. Can any of you throw me a fish on how I can loop through the source data and the pivot table data values to do this?
My current macro is below as a reference.
Code:
Public Sub format_zero_valued_cells()
Dim rngPTData As Range
Dim RngCell As Range
Dim RngSrcData As Range
Set rngPTData = ActiveSheet.PivotTables(1).DataBodyRange
'set start cell for find
Set RngCell = rngPTData.Cells(1)
Application.ScreenUpdating = False
For Each RngCell In rngPTData
If RngCell.Value = 0 Then
RngCell.Font.ColorIndex = 37
End If
Next RngCell
Application.ScreenUpdating = True
Set rngPTData = Nothing
Set RngCell = Nothing
End Sub
I also took a look at some code written by Mike Alexander at datapig that is pretty cool and gets me part way there, but it only takes me to the column level and I havn't been able to figure out how to modify it to my needs. See http://datapigtechnologies.com/blog...tch-source-data/comment-page-1/#comment-20916
Any insight will be greatly appreciated.
thanks,
rick