vibin_panda
New Member
- Joined
- Sep 23, 2021
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
Hello! I am quite new to Excel Macros/VBA and I could use some help with this problem I'm facing:
I have a table like this in excel and I'm trying to automate the creation of a pivot table that takes Shop as rows and #Doughnuts as values in the pivot table. The data is also supposed to be filtered for year only for 2021. Only those weeks that are yet to come should be selected (e.g. if it's week 49 right now, then only from week 50, 51, 52 should be selected and the rest should be excluded from the filter of the pivot table). I have to create this pivot table once every week and currently I am manually excluding the weeks that have already gone by from the filter. I can create a macro for creating the pivot table and filtering the year but I'm struggling to create a VBA query that filters the weeks in this incremental manner, where it's excluding the past weeks, current week and only taking what's going to come next.
Any help would be extremely appreciated!!
Year | Week | # Doughnuts | Shop |
2020 | 1 | 34 | Krispy Kreme |
2021 | 25 | 23 | Dunkin Doughnuts |
2021 | 3 | 34 | Crosstown Doughnuts |
2020 | 32 | 354 | Dunn's Bakery |
2020 | 51 | 98 | Bread Ahead Bakery |
2021 | 35 | 243 | Happy Donuts |
2020 | 4 | 76 | Doughnut Time |
I have a table like this in excel and I'm trying to automate the creation of a pivot table that takes Shop as rows and #Doughnuts as values in the pivot table. The data is also supposed to be filtered for year only for 2021. Only those weeks that are yet to come should be selected (e.g. if it's week 49 right now, then only from week 50, 51, 52 should be selected and the rest should be excluded from the filter of the pivot table). I have to create this pivot table once every week and currently I am manually excluding the weeks that have already gone by from the filter. I can create a macro for creating the pivot table and filtering the year but I'm struggling to create a VBA query that filters the weeks in this incremental manner, where it's excluding the past weeks, current week and only taking what's going to come next.
Any help would be extremely appreciated!!