Hi everyone,
I am very new to programming, only having dipped my toe into Python and VBA recently. I have a data set from work that I plug into my first sheet.
In my macro I:
1) Create a filter and filter the data.
2) Copy and Paste Special to a different sheet to only have the values from the filter.
3) Create a Pivot table from that data.
Now, at this point I start having some issues. I first tried creating a new sheet, and posting the pivot table in there hoping to delete the sheet at the end of the macro. That gets held up when I rerun the macro because it creates a sheet with a number 1 higher than the sheet it created before. I then thought to create a Pivot Table by selecting create new sheet but the same problem occurs. Then I tried having the sheet already there before the macro starts recording. The sheet no longer becomes the issue but the Pivot Table now creates the error because of the new Pivot Table name.
Having seen some basic tutorials online and answers from here I know I face two challenges so this is what I want to know:
1) How do get the sheet the macro creates to be the same sheet name each time to avoid the error above?
2) How do I get the Pivot Table name to be the same each time so that the same problem does not happen there?
Thank you for your time.
I am very new to programming, only having dipped my toe into Python and VBA recently. I have a data set from work that I plug into my first sheet.
In my macro I:
1) Create a filter and filter the data.
2) Copy and Paste Special to a different sheet to only have the values from the filter.
3) Create a Pivot table from that data.
Now, at this point I start having some issues. I first tried creating a new sheet, and posting the pivot table in there hoping to delete the sheet at the end of the macro. That gets held up when I rerun the macro because it creates a sheet with a number 1 higher than the sheet it created before. I then thought to create a Pivot Table by selecting create new sheet but the same problem occurs. Then I tried having the sheet already there before the macro starts recording. The sheet no longer becomes the issue but the Pivot Table now creates the error because of the new Pivot Table name.
Having seen some basic tutorials online and answers from here I know I face two challenges so this is what I want to know:
1) How do get the sheet the macro creates to be the same sheet name each time to avoid the error above?
2) How do I get the Pivot Table name to be the same each time so that the same problem does not happen there?
Thank you for your time.