Hello!
I’m needing a bit of VBA code help if possible… I’ve attached an Excel file with an example of what I’m trying to accomplish.
My goal is to have a macro change the pivot table calclated item formulas to reflect what is listed in columns “J” and “L” on the “Periods” worksheet . My problem is that the list may have all 13 periods, or maybe just 3 periods, depending on which period they select (try selecting a different period in cell “I16” and the lists change). I’m not sure how to write that variablity into the macro.
I plan to have multiple pivot tables in one workbook, and when a user changes the period in cell “I16” to select which month he would like to view, the YTD calculated items in the pivot tables will change to what is in columns “J” and “L” on the “Periods” worksheet.
I simply recorded a macro and then tried to input which sheet & cell to look at (see the macros in the example file), but it didn’t work. I’m assuming an IF Then type code would be the route to go, If Sheet7.Range(“E10”) = 12 Then…. have the calculated item add the all 13 items, If Sheet7.Range(“E10”) = 11 Then… have the calculated item add only the 12 periods, etc., but I’m clearly missing something in the simple macro first, so going on to write in the If Then code won’t work until I get that fixed????
As usual, any help is always appreciated!!
Thanks!
Lana