+ Reply to Thread
Results 1 to 4 of 4

Hide all rows below row of cell

  1. #1
    Registered User
    Join Date
    04-17-2013
    Location
    St. Louis
    MS-Off Ver
    Excel 2010
    Posts
    36

    Hide all rows below row of cell

    Hey there. I'd like to hide all rows below the row of a cell with a given value in it.

    Here's what the code does currently:

    The first line just unhides everything that was previously hidden.

    In cells D2:D5 I have the numbers 2,3,4, and 5 each (2 is in D2, 3 is in D3, etc.). In cell F2, I can type in either 2,3,4, or 5 and then run the macro. If the value in F2 matches the value in any of the cells in column D, the given row will be hidden. For instance, if I typed in "3" into cell F2, row 3 would be hidden. Then, if I typed in "4" into cell F2, row 3 would be unhidden and then row 4 would be hidden.

    Please Login or Register  to view this content.
    What I want to do though is if I type in "3" in cell F2, it should hide everything BELOW row 3. If I type in "2" in cell F2, it should hide rows 3 and down. Is there a way to do this while keeping the first three lines of the code intact preferably?

    Any help would be much appreciated!

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Hide all rows below row of cell

    Try:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-17-2013
    Location
    St. Louis
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: Hide all rows below row of cell

    When I try
    Please Login or Register  to view this content.
    it says "Compile Error: Sub or Function not Defined" and when I try

    Please Login or Register  to view this content.
    it says runtime error 424: Object Required.

  4. #4
    Registered User
    Join Date
    04-17-2013
    Location
    St. Louis
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: Hide all rows below row of cell

    Never mind! It works perfectly as you suggested it, I was inputting it wrong. Thank you VERY much!!!

+ 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 with a Value (2 values to hide) then delete visible rows
    By Slea in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-19-2013, 06:25 AM
  2. Hide multiple rows below target cell based on a cell value match elsewhere.
    By tapmagoo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-09-2013, 12:37 PM
  3. [SOLVED] Hide Rows if a cell has a value
    By Sky188 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-18-2012, 11:22 PM
  4. Using check boxes to hide and un-hide rows with drop down lists within rows
    By Sparky_Chris in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-24-2012, 07:22 AM
  5. hide rows If a cell value is zero.
    By Benb in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-26-2011, 10:57 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