+ Reply to Thread
Results 1 to 5 of 5

Question about how to hide multiple rows based upon cell values.

  1. #1
    Registered User
    Join Date
    09-18-2023
    Location
    Hooton, UK
    MS-Off Ver
    Microsoft 365 Apps for Enterprise
    Posts
    12

    Question Question about how to hide multiple rows based upon cell values.

    Hi, hoping someone can help me please.

    I would like to be able to hide multiple, specific rows based upon answers selected from a drop-down in multiple cells.

    For example, on Row 2 the question is "Do you prefer Red or Blue?", if the user selects Red then rows 90-100 are hidden.

    Then, on Row 3 the question is "Do you like Square or Round?", if the user selects Round then rows 110-120 and rows 150-160 are hidden.

    I also then want them to revert to being visible if the opposite answers are selected for the questions on Rows 2 & 3 as above.

    Hope that makes sense and THANK YOU for any VBA code.

    Simon.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Question about how to hide multiple rows based upon cell values.

    1) Copy this code.
    2) Right-Click the sheet tab of interest.
    3) Select "View Code"
    4) Paste the code into the window that appears.
    5) Save the file as a macro-enabled .xlsm file.
    6) Make changes as needed

    If you have trouble expanding the code, post back with more specifics.

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    09-18-2023
    Location
    Hooton, UK
    MS-Off Ver
    Microsoft 365 Apps for Enterprise
    Posts
    12

    Re: Question about how to hide multiple rows based upon cell values.

    Thanks, will try this.

  4. #4
    Registered User
    Join Date
    09-18-2023
    Location
    Hooton, UK
    MS-Off Ver
    Microsoft 365 Apps for Enterprise
    Posts
    12

    Re: Question about how to hide multiple rows based upon cell values.

    Seemed to work OK initially, then I got an issue about 'target range", as below in VBA:
    Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Cells.Count > 1 Then Exit Sub
    If Target.Value = "" Then Exit Sub
    If Target.Address = "$C$2" Then Range("78:93").EntireRow.Hidden = Target.Value = "No"
    If Target.Address = "$C$3" Then Range("16:29,31").EntireRow.Hidden = Target.Value = "T3/T4"

    End Sub

  5. #5
    Registered User
    Join Date
    09-18-2023
    Location
    Hooton, UK
    MS-Off Ver
    Microsoft 365 Apps for Enterprise
    Posts
    12

    Re: Question about how to hide multiple rows based upon cell values.

    Think I've sorted it, changed the single 31 to 31:31........seems OK now.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help needed to hide rows based on multiple cell values
    By kylemiller in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2016, 07:29 PM
  2. hide/unhide rows based on multiple cell values
    By saninmelbourne in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-20-2012, 06:45 PM
  3. Hide rows based on multiple column values
    By dtanios in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-07-2012, 02:09 PM
  4. Help: Code to hide multiple rows based on different cell values
    By swamy156 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-24-2012, 04:35 AM
  5. Hide Rows based on cell values
    By Chinny123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-23-2011, 08:45 AM
  6. Hide rows based on cell values
    By mlb830 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-18-2009, 05:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1