Hi Excel Experts,
I found this cool simple macro that helps me to create an action button which will hide/unhide the rows set in the macro accordingly. However, what I want to achieve is not based on row number, but also based on the value/criteria in a cell.
Macro :
Sub rowExpanded()
Rows("7:10").Select
Selection.EntireRow.Hidden = IIf(Selection.EntireRow.Hidden, False, True)
End Sub
Here's the scenario.
I have rows of data which consists of columns as below:-
Col A Col B Col C
Month Dept Details
Jun POS abcdefg
Jul HR tytytyty
Jan IT info1
Jan POS info123
Jun HR inform5567
Jan POS moreinf1111
Jan POS sdgreyt
Jan POS ghfghfgh
Jun IT erohfkzjfk
Cell D1 = Jan
Cell D2 = POS
I want the macro to be able to hide/unhide any row based on criterias in col A and B.
e.g. Hide/Unide rows that is not the month Jan in col A and dept POS. Result should be those rows which are not Jan and non-POS dept shall be collapsed:-
Col A Col B Col C
Month Dept Details
Jan POS info123
Jan POS moreinf1111
Jan POS sdgreyt
Jan POS ghfghfgh
Is this achievable by macro? Hopefully so. I know there is an option to use filter but I thought to make it much easier for user to just click a button and excel does it all.
Thank you in advance.
Bookmarks