Hey Shekar,
Thanks for answering the question, the only problem is I cannot add the pivot fields individually. This is because I am trying to make this code universal where it can be used on multiple workbooks with many different number of 'Points' fields.
For example, sample1.xls has 2 fields that has 'Points' in the field name, but sample2.xls has 12 fields with 'Points' in the field name.
So to make it universal I need the code to loop through all pivot fields looking for the word 'Points' within the fieldname and then add it to the data field.
I have tried to create this code but failed, this is how far I got:
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
For Each pf In pt.PivotFields
If InStr(pf.Value, "Points") = 1 Then
'Do Something
Else
Exit Sub
End If
Next pf
Does anyone have any ideas?
Kind Regards
mini12
Bookmarks