Forum Discussion

Steiny88's avatar
Steiny88
Copper Contributor
Jul 24, 2022

Hide rows in a different sheet based on a value (that contains specific letters)

I have 2 sheets and attached an example:


Sheet1 D8 has Baby as value
Sheet1 D9 has Man as value
Sheet1 D10 has Woman as value

The code to search for "ab" in column D and if it finds it somewhere to hide row 8 from sheet2
Second condition is to search for ma in column D to hide row 9 from sheet2
Third condition is to search for om in column D to hide row 10 from sheet2

FYI - I will need to have 6 more conditions, but let's see if there is such code where it searches for containing letters in a column and also the code to be automatic not to run it every time and if there is nothing written in column D to

unhide all rows from sheet2.

Thank You!

11 Replies

    • Steiny88's avatar
      Steiny88
      Copper Contributor
      I didn't realize that 😄
      Let's say to use wo from woman as I will not have any duplications in the original file.
      • Steiny88 

        See the attached workbook. It is now a macro-enabled workbook (*.xlsm) so you'll have to allow macros when you open it.

        To view the code, right-click the sheet tab of Sheet1 and select 'View Code' from the context menu.

Resources