View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
wesley24 wesley24 is offline
external usenet poster
 
Posts: 3
Default Is it possible to add variables to a pivot datafield name?

Hello,

I am tring to get the user to input the abbreviation for the month
they would like to pivot on, assign it to a variable, and use it to
identify which datafield to select.

* PivMonth = InputBox(prompt:="Please enter the abbreviation for the
month you would like to see in your pivot table. (ex. Dec)")

Set WIPcache =
WB.PivotCaches.Add(SourceType:=xlDatabase, SourceData:=PivRng.Address)
Set WIPpiv =
WIPcache.CreatePivotTable(Tabledestination:=Piv.Ra nge("A3"),
Tablename:="PivWIP")

With WIPpiv.PivotFields("Program ID")
.Orientation = xlRowField
End With

* ActiveSheet.PivotTables("PivWIP").AddDataField
ActiveSheet.PivotTables("PivWIP" _
).PivotFields(PivMonth & "USD"), xlSum

Thank you,
Wes