title: adding field to pivot table using VBA
body: <pre><code>ActiveSheet.PivotTables("PivotTable5").AddDataField ActiveSheet.PivotTables( _
      "PivotTable5").PivotFields(range("hidy!B" &amp; pos).Value), "Sum of " &amp; range("hidy!B" &amp; pos).Value, xlSum
  </code></pre>
  
  <p>Hello I am ading and removing fields from pivot table according to user drop down control. But in above code I am getting error message "unable to get pivotfields property of the pivottable class". I am very new to VBA excel, please help me figure it out</p>