+ Reply to Thread
Results 1 to 10 of 10

Unhide/Hide Next Row if Cell Is Blank/Not Blank

  1. #1
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    500

    Unhide/Hide Next Row if Cell Is Blank/Not Blank

    Greetings,
    I am using the following code to unhide/hide the next row if the cells in Column B are blank/not blank (rows 16 - 77). The unhide portion of the code only works when I click in the cell after typing. However, the hide portion works immediately after deleting the contexts of the cell.
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Unhide/Hide Next Row if Cell Is Blank/Not Blank

    Does this work for you?
    When you change a cell in column B

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    500

    Re: Unhide/Hide Next Row if Cell Is Blank/Not Blank

    ByteMarks,
    Thank you for your reply and I apologize for not responding earlier.
    Your code works great in hiding the rows if the cell in the above row is blank. However, it does not unhide the row if the cell is not blank. I have been working on modifying your code, but my VBA skills are limited.

  4. #4
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Unhide/Hide Next Row if Cell Is Blank/Not Blank

    Your code works great in hiding the rows if the cell in the above row is blank.
    It shouldn't do based on Unhide = Blank and Hide = Not Blank
    If you take B17 for example. Populating it should hide row 18. Deleting the contents should reveal row 18

    If that's not correct then perhaps I've misunderstood the requirement?

  5. #5
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    500

    Re: Unhide/Hide Next Row if Cell Is Blank/Not Blank

    I am so sorry. It should be based on Unhide = Not Blank and Hide = Blank. I had it backwards.

  6. #6
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Unhide/Hide Next Row if Cell Is Blank/Not Blank

    Ah ok.

    Try it like this.

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    500

    Re: Unhide/Hide Next Row if Cell Is Blank/Not Blank

    Works Perfect!!
    And I see why. By adding the " = 0" to the end of the code, it changes the True to False. Thus reversing the Hidden.
    Again, thank you very much. I have learned a valuable lesson!!!
    By the way, I tried to give add an Add Reputation, but would not allow.

  8. #8
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Unhide/Hide Next Row if Cell Is Blank/Not Blank

    Happy to help.

    On the original (incorrect) code, you could have written it as follows, which gives a bit more context to =0 in the reversal.
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    500

    Re: Unhide/Hide Next Row if Cell Is Blank/Not Blank

    Is it possible to use this code with merged cells.

  10. #10
    Forum Contributor
    Join Date
    07-07-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    500

    Re: Unhide/Hide Next Row if Cell Is Blank/Not Blank

    Forget my previous post - I had incorrectly set the starting row.

+ 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. Toggle hide/unhide columns based on another cell being blank or not
    By BenHarris in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-10-2021, 12:27 AM
  2. [SOLVED] Toggle Button to hide/unhide blank rows
    By therealaccountant in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-05-2019, 07:56 PM
  3. [SOLVED] Hide and Unhide base on blank cell in range
    By kepasso in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-04-2016, 11:24 AM
  4. [SOLVED] Hide/Unhide rows dependent on value (0 or blank)
    By masat in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-07-2016, 09:34 AM
  5. [SOLVED] macro to hide rows if cell is blank, unhide if it contains text
    By Russ Fuquay in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2013, 10:02 PM
  6. [SOLVED] Hide unhide blank rows?
    By jeff p in forum Excel General
    Replies: 6
    Last Post: 04-03-2012, 09:48 AM
  7. Excel 2007 : Hide/Unhide blank rows assigned to a check-box
    By Prof-pat-pending in forum Excel General
    Replies: 10
    Last Post: 09-05-2009, 03:50 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