This macro sets two input cells to the start and end dates that represent a quarter-to-date period and then runs all Snowflake queries in the workbook that contains the macro.
This implies that one or more in-cell SQL statements in the workbook have a between
constraint in their where
clause that references these two input cells. For example:
2024-10-01 | 2024-12-31 | |
select sym, sum(pnltot) from positions where dt between $start_date and $end_date group by sym |
When would you use something like this? Like many VBA macros, this is just for convenience. If you, or the users of your model, are frequently entering the quarter-to-date period into the input cells and then refreshing data for this period, you can automate these steps by adding a 'Run for QTD' button atop your sheet which calls this macro.
Public Sub RefreshAllQuarterToDate() |