Retroshift
Board Regular
- Joined
- Sep 20, 2016
- Messages
- 119
- Office Version
- 2019
- Platform
- Windows
Hi,
I have the following formula which is inserted on sheets through VBA code:
The A2:A3 range contains two holiday dates which are on a separate worksheet. The holidays change depending on the year entered in an inputbox.
Every year entered in the inputbox creates a new sheet for that year. The new sheet contains the formula above including the holiday range.
Now, when I create a sheet for the year 2023 for example, the formula consists the holiday range for that year (2023). But, when I create a new sheet for the year 2024, the holiday range refers to the year 2024 for both sheets 2023 and 2024. My question is: how to solve this issue by making the holiday range formula dynamic so that the newly created 2023 sheet contains the formula referring to the holidays of 2023, and the newly created 2024 sheet contains the formula referring to the holidays of 2024?
I have the following formula which is inserted on sheets through VBA code:
Excel Formula:
=SUMPRODUCT((B3:AF3="AD")*(WEEKDAY(B2:AF2,2)<6)*(ISNA(MATCH(B2:AF2,HolidaySheet!A2:A3,0))))
Every year entered in the inputbox creates a new sheet for that year. The new sheet contains the formula above including the holiday range.
Now, when I create a sheet for the year 2023 for example, the formula consists the holiday range for that year (2023). But, when I create a new sheet for the year 2024, the holiday range refers to the year 2024 for both sheets 2023 and 2024. My question is: how to solve this issue by making the holiday range formula dynamic so that the newly created 2023 sheet contains the formula referring to the holidays of 2023, and the newly created 2024 sheet contains the formula referring to the holidays of 2024?