+ Reply to Thread
Results 1 to 4 of 4

IF cell contains ANYTHING then hide the entire row

Hybrid View

  1. #1
    Registered User
    Join Date
    11-03-2004
    Posts
    75

    Question IF cell contains ANYTHING then hide the entire row

    Tried to use the macro recorder, turn on filtering and leave the blanks visible - but it would not allow me to --
    Need a simple Sub to perform this task on my "active sheet" (don't want to hardcode in a specific sheet name to use generically)

    IF Column "I"
    (starting with row 2 down) contains ANYTHING then hide entire row.

    (currently that column holds dates with headers in row 1:1) but hoping the code can be generic (not hard coded to look for dates)

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: IF cell contains ANYTHING then hide the entire row

    Sub t()
    With ActiveSheet.Range("I2", Cells(Rows.Count, "I").End(xlUp))
        .SpecialCells(xlCellTypeConstants).EntireRow.Hidden = True
    End With
    End Sub
    Last edited by JLGWhiz; 02-17-2018 at 09:15 PM.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    11-03-2004
    Posts
    75

    Re: IF cell contains ANYTHING then hide the entire row

    That's it! Awesome -- thanks greatly!
    REPUTATION points given

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: IF cell contains ANYTHING then hide the entire row

    Quote Originally Posted by CHRISOK View Post
    That's it! Awesome -- thanks greatly!
    REPUTATION points given
    You're welcome and thanks for the reps.
    Regards, JLG

+ 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. If cell value in range = 0 then hide entire row
    By mysticmoron109 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-29-2016, 01:40 PM
  2. [SOLVED] How to hide entire row if a cell therein has 0 value
    By masud_jahan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-28-2016, 12:12 AM
  3. [SOLVED] Delete or hide entire column if top cell is blank
    By idowbush@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-09-2014, 12:59 PM
  4. toggle with macro to hide/unhide entire row with cell that contains specific text
    By duvius in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-14-2013, 03:04 PM
  5. Hide entire row based on another tab cell content
    By lorne17 in forum Excel General
    Replies: 0
    Last Post: 07-12-2012, 04:18 PM
  6. When cell is modified Hide Entire Rows in a Range
    By Hudas in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-09-2012, 09:43 AM
  7. Replies: 2
    Last Post: 10-03-2005, 10:05 AM

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