[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Excel: Hide Multiple Row Selections Based on Other Cell Value

Posted on 2014-08-13
Medium Priority
Last Modified: 2014-08-14

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.
Question by:dabug80
  • 3
LVL 27

Expert Comment

by:Glenn Ray
ID: 40261835
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

Any Red, Yellow, or Green rows.

LVL 27

Accepted Solution

Glenn Ray earned 2000 total points
ID: 40261885
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
        Rows("6:11").EntireRow.Hidden = False
    End If
    If Sheets("Trigger").Range("B8").Value = "Yes" Then
        Rows("14:20").EntireRow.Hidden = True
        Rows("14:20").EntireRow.Hidden = False
    End If
    If Sheets("Trigger").Range("B11").Value = "Yes" Then
        Rows("23:29").EntireRow.Hidden = True
        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.


Author Closing Comment

ID: 40262089
Excellent. Works well, thanks
LVL 27

Expert Comment

by:Glenn Ray
ID: 40262134
You're welcome.  


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question