Hi excel experts, I have a tricky VBA macro I am trying to write and I'm hoping someone will be able to help me out. If I have a date value in cell "B1", how would I go about writing the macro to show or copy 13 columns with the first column header matching the date value in "B1", then showing the next 12 columns after that and hiding the rest. For a better explanation of what I'm trying to achieve, I am attaching some pictures below of what the end goal is:
In the picture above my target date in "B1" is 2022/11/13, so I would like the macro to check the column headers from "C" to "S", match where the column header in row 3 matches 2022/11/13, then take the next 12 columns afterwards that have the Planned header above the date cell and ignoring the Actuals columns. So the end goal of this macro would be the next picture below.
From what I understand, I need an if statement to check the condition for a match between "B1" and the range of columns, and if the condition is matched then loop the range of columns using a do until loop that stops at 13, with the column headers being planned as well. I'm just not sure how to write this in VBA code, please will somebody help me. I'm a bit stuck as I'm quite new to VBA, thank you!
In the picture above my target date in "B1" is 2022/11/13, so I would like the macro to check the column headers from "C" to "S", match where the column header in row 3 matches 2022/11/13, then take the next 12 columns afterwards that have the Planned header above the date cell and ignoring the Actuals columns. So the end goal of this macro would be the next picture below.
From what I understand, I need an if statement to check the condition for a match between "B1" and the range of columns, and if the condition is matched then loop the range of columns using a do until loop that stops at 13, with the column headers being planned as well. I'm just not sure how to write this in VBA code, please will somebody help me. I'm a bit stuck as I'm quite new to VBA, thank you!