Excel: Hide Multiple Row Selections Based on Other Cell Value

Hello,

Attached is a spreadsheet with 2 sheets. On the trigger sheet, when the value of a yellow cell is yes, I would like the corresponding coloured rows on the 'rows to hide' sheet to become hidden. I would also like the image set atop the rows to be hidden.

Also for the opposite, if the value is no longer Yes, the rows are to be unhidden and the image is to be visible.

Is it possible to easily embed images within cells so they can move up/down and be hidden with cells?

Thanks for your help.
Hide-Rows.xlsx
LVL 1
dabug80Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Glenn RayExcel VBA DeveloperCommented:
To answer your last question first, yes, you can change the image attributes so that they move/resize with their associated cells like so:
object positioning - move and resize with cellsThat will allow the graphics to be hidden/shown along with the rows.

Regarding your main question:  do you want to show/hide the specific rows in this example or ANY colored rows on that sheet?
So either:
Red = rows 6:11
Yellow =  rows 14:20
Green = rows 23:29

-or-
Any Red, Yellow, or Green rows.

Regards,
-Glenn
0
Glenn RayExcel VBA DeveloperCommented:
IF, your answer to my last question is that the specific, numbered rows are to be hidden/unhidden, this Worksheet_Activate event inserted in the "Rows to Hide" sheet object module will make the rows follow your requested behavior:
Private Sub Worksheet_Activate()
    If Sheets("Trigger").Range("B5").Value = "Yes" Then
        Rows("6:11").EntireRow.Hidden = True
    Else
        Rows("6:11").EntireRow.Hidden = False
    End If
    If Sheets("Trigger").Range("B8").Value = "Yes" Then
        Rows("14:20").EntireRow.Hidden = True
    Else
        Rows("14:20").EntireRow.Hidden = False
    End If
    If Sheets("Trigger").Range("B11").Value = "Yes" Then
        Rows("23:29").EntireRow.Hidden = True
    Else
        Rows("23:29").EntireRow.Hidden = False
    End If
End Sub

Open in new window


I've attached a modified version of your workbook for you to test.

Regards,
-Glenn
EE-Hide-Rows.xlsm
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dabug80Author Commented:
Excellent. Works well, thanks
0
Glenn RayExcel VBA DeveloperCommented:
You're welcome.  

-Glenn
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.