I am currently trying to type code that will verify the data of two column fields (FM, COSTTYP) in a pivot table. There is probably an easier way to go about it, but would like the code to identify that for each item within the "FM" field (ex. "2010/10"), there is also corresponding "Actual" data within the "COSTTYPE"field.
Set PT = ActiveSheet.PivotTables(1)
ForMth = PT.PivotFields("FM")
For Each ForMth In PT.PivotFields("FM").PivotItems
n = ForMth.Name
On Error GoTo NotVisible
PT.PivotSelect "Actual n", xlDataAndLabel, True
I am using a variable rather than try and hard code each individual pivot item under "FM". The problem is within the bolded line which will not recognize that n = the current pivot item. Anyone have a better idea how to rephrase the code or even a different approach?