![]() |
PivotTable VBA help needed
Hi I am really stuck with this one and spent hours trying to work it out but
without success I am trying to get a pivot table field to return/Copy a name from a cell on a sheet, For example in the ROW section of the Pivot Table there could be up to a hundred questions to select from (which could change from week to week) and as you can imagine would be a nightmare to keep changing, especially as there is going to be 50 sheets/tabs to change in the workbook. I copied and tried to adapt this code that I found earlier without success: Sub Macro2() Dim ID As String Dim PT As PivotTable Dim PF As PivotField Dim PI As PivotItem ID = ActiveSheet.Range("question_title") On Error Resume Next For Each PT In ActiveSheet.PivotTables Set PF = PT.PivotFields.question_title Set PI = Nothing Set PI = PF.PivotFields(ID) Next On Error GoTo 0 End Sub I named the cell with a Range Name of question_title, but I presume I will need to have a different name for each tab or can I just specify a cell? Help as usual greatly appreciated John |
All times are GMT +1. The time now is 12:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com