Hello everybody,

I am experiencing an issue with changing the data source for a pivot table as a part of a macro that takes about 15 minutes to run, but I currently have to do it in two steps because I cannot figure out how to automate this step via VBA macro code.

I have tried both refreshing the pivot table and pivot cache with no success. When I perform this step manually, I select the pivot table sheet, go to pivot options, then change data source, and include the used range for the pivot table's dataset. I know there has to be a way to do this with code. Please help. Thanks.