I am trying to write a VBA code that would allow me to hide all columns containing whatever text/option has been selected from a drop down list in excel.
For example, all the drop down list options are within columns I:FT. The drop down list contains "Cat", "Dog", "Horse", "Fish", " " <—blanks. If I am selected on the blank " " option in the drop down list then I want to hide all columns in “I:FT” containing blanks.
When it does hide the columns containing blanks, all rows in the column must be blank when the I:FT range is selected. The range of these cells are 416R x 169C.
Additionally, I need it to only account for visible rows. I want it to have the ability to filter on a column (such as part number) and have the macro run and only hide the columns with blanks based off whatever is shown from the filtered part number.
The drop down list is associated cell H2 and the list is on another sheet in the background
I am fairly new to writing VBA code and any help would be MUCH appreciated.
Thank you !