Hello,
I am very new to VBA so I can't work out a way to do the following:
I have an Excel Table with multiple Rows and Columns. What I would like to be able to do is, after applying a Filter on the table, all columns which have only 0 or empty cells to become automatically hidden.
I thought that perhaps an easy solution would be to first to use the Count function on the Totals Row of the Table. Therefore, if after applying a filter, all the cells were 0 or empty the Totals Row would be equal to zero too since this function is dynamic and changes after applying a filter.
VBA could check the value on the Totals Row of the table using ActiveSheet.ListObjects("Table1").TotalsRowRange.Select and if the cell is equal to 0 after applying the filter then it would hide the respective column using the function .EntireRow.Hidden = True .
Unfortunately, I don't know how to write this down as a VBA module. I 'd appreciate any help.
Hide Empty Columns.xlsx
Bookmarks