title: How to fetch actual pivottable data from first rowfield of it using VBA
body: <p>Thanks for all your help in past. I got stuck again in something and I am not able to solve it after so many tries and once again need your help.</p>
  
  <p>I want to extract values of the 1st rowfield which are showing in the pivottable after applying all the filters. Below code is providing ALL the value of 1st rowfield even though only 5 values are showing in the pivottable. </p>
  
  <p>Check the screen shot here: </p>
  
  <p><a href="https://i.stack.imgur.com/KNdB7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KNdB7.png" alt="Image"></a></p>
  
  <p>As per image above, I want only 7,41,60,61,62 values however loop is running for all the 80 SN.NO of the sourcedata.</p>
  
  <pre><code>Sub GetRowItems()
  
      Dim pi As PivotItem
      Dim val As String
  
      'Set variables
      ThisWorkbook.Worksheets("Report").Activate
      Set pt = ActiveSheet.PivotTables(1)
      Set pf = pt.RowFields(1)
  
      'pt.PivotFields(pf.Name).DataRange.Select
      If pf Is Nothing Then Exit Sub
  
      For j = 1 To pf.PivotItems.count
          'MsgBox pf.PivotItems(j).Name
          val = pf.PivotItems(j).Name
      Next j
  
  End Sub
  </code></pre>