+ Reply to Thread
Results 1 to 11 of 11

Hide Rows Based on Cell Value

  1. #1
    Registered User
    Join Date
    01-28-2015
    Location
    Tampa, FL
    MS-Off Ver
    2010
    Posts
    104

    Hide Rows Based on Cell Value

    Hi Everyone,

    I'm trying to write a simple VBA but I can't get it to work.

    In the Worksheet code, I am trying to have the worksheet automatically hide certain rows based on a cell's value.

    If cell E3 = IL, I would like rows 32-85 hidden
    If cell E3 = ISA, I would like rows 12:31 hidden
    If cell E3 = IL/ISA, I would like NO rows hidden

    Would someone be able to advise as to what I am doing wrong with the code below:

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    If Range("E3").Value = "IL" Then
    Rows("32:85").EntireRow.Hidden = True


    ElseIf Range("E3").Value = "ISA" Then
    Rows("12:31").EntireRow.Hidden = True

    End If

    End Sub

  2. #2
    Registered User
    Join Date
    01-28-2015
    Location
    Tampa, FL
    MS-Off Ver
    2010
    Posts
    104

    Re: Hide Rows Based on Cell Value

    I need to *BUMP* this as I am still at a lost.

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Hide Rows Based on Cell Value

    In what way doesn't it work?

  4. #4
    Registered User
    Join Date
    01-28-2015
    Location
    Tampa, FL
    MS-Off Ver
    2010
    Posts
    104

    Re: Hide Rows Based on Cell Value

    If I select a person's name via dropdown box, and their value in E3 is "IL", rows 32:85 hide as expected. However, If I choose another person's name, and their value in E3 changes to "ISA", rows 32:85 do not Unhide and rows 12:31 do not hide.

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Hide Rows Based on Cell Value

    That doesn't answer my question.

  6. #6
    Registered User
    Join Date
    01-28-2015
    Location
    Tampa, FL
    MS-Off Ver
    2010
    Posts
    104

    Re: Hide Rows Based on Cell Value

    Once rows are hidden, they are not unhidden if a different value is in E3.

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Hide Rows Based on Cell Value

    Where is the dropdown located & is it a Data validation dropdown?

  8. #8
    Registered User
    Join Date
    01-28-2015
    Location
    Tampa, FL
    MS-Off Ver
    2010
    Posts
    104

    Re: Hide Rows Based on Cell Value

    It's a drawn box with a Format Control linking an Input Range "Data!$B$4:$B$38", Cell Link "$B$3", and Drop Down Lines "8". It is listed on the same sheet.
    Last edited by tkbuc; 06-12-2019 at 02:17 PM.

  9. #9
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Hide Rows Based on Cell Value

    Ok, how about
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    01-28-2015
    Location
    Tampa, FL
    MS-Off Ver
    2010
    Posts
    104

    Re: Hide Rows Based on Cell Value

    Yes! Thank you! Thank you! Thank you!

  11. #11
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Hide Rows Based on Cell Value

    You're welcome & thanks for the feedback

+ 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. Hide Rows based on cell value
    By Wiggy74 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-20-2017, 11:18 AM
  2. Hide Rows/Hide Columns Based on Value in Cell
    By brickwall823 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2015, 02:42 PM
  3. Need Toggle Button to hide/unhide rows based on cell value in non concurrent rows
    By The Phoenix in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-13-2015, 10:49 AM
  4. Hide Rows based on cell value
    By mjg060468 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-07-2014, 12:28 PM
  5. [SOLVED] First unhide all rows - then hide rows based on specific cell value for a range of cells
    By robbiekh in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-22-2013, 05:46 PM
  6. [SOLVED] Hide Rows based on Cell Value
    By nogoodnames in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-21-2012, 05:39 PM
  7. [SOLVED] hide rows based on value in cell
    By dummster in forum Excel General
    Replies: 0
    Last Post: 02-15-2006, 11:30 AM

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