title: Excel crash and needs to restart when editing pivot
body: <p>The following code adds every Pivot Field into the Pivot Table's Value Field. I want this to happen for my database, but my Excel keeps crashing when I run this. I tried stepping through the code to see where it stops, and it's crashing at <code>.Orientaton = xlDataField</code> after adding 29 Pivot Fields in. I tried doing this by hand and I can do it by hand no problem. I manually added 50 of them and no crashes. Any thoughts on why this might be happening?</p>
  
  <pre><code>Sub AddAllFieldsValues()
  'Update 20141112
      Dim pt As PivotTable
      Dim I As Long
      For Each pt In ActiveSheet.PivotTables
          For I = 1 To pt.PivotFields.Count
              With pt.PivotFields(I)
                If .Orientation = 0 Then .Orientation = xlDataField
              End With
          Next
      Next
  End Sub
  </code></pre>
  
  <p>Figured out the problem: The title of column 29 in the database has 254 characters in it, and that's what causing the program to fail. When I change the title to a smaller one, it runs fine, and when I put that field into the pivot table by hand it works fine... Any thoughts on why this happens?</p>
  
  <p>Edit: The answer that @Andrey Ampilogov shared helped me solve my problem. I just added a row below the original title row and did =left(cell above,100), copy and pasted as values on top of itself to remove formulas and that solved my problems.</p>