+ Reply to Thread
Results 1 to 4 of 4

Hide Rows if a cell has a value

  1. #1
    Forum Contributor
    Join Date
    02-14-2011
    Location
    West Valley City, Utah
    MS-Off Ver
    Excel 2010
    Posts
    108

    Hide Rows if a cell has a value

    Good afternoon everyone,

    I'm looking for VBA code that will hide a row if a cell meets a certain value.

    For example, if A1 = "A", hide rows 2-5.
    Last edited by Sky188; 09-25-2012 at 01:29 PM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Hide Rows if a cell has a value

    Hi, Sky188,

    something like
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Contributor
    Join Date
    02-14-2011
    Location
    West Valley City, Utah
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Hide Rows if a cell has a value

    HaHoBe,
    Thanks for the reply, unfortunately it doesn't seem to be working.
    To elaborate a bit on what I'm trying to accomplish with more details,
    I've got a checkbox that when clicked will return the value 1 or 0 in A1 using the code
    Please Login or Register  to view this content.
    And this code works perfectly. When a 0 is returned, I want rows 2 and 3 to be hidden, and when a 1 is returned I want rows 2 and 3 to be unhidden. I tried the code
    Please Login or Register  to view this content.
    But I'm having issues with this also. Any suggestions?

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Hide Rows if a cell has a value

    Hi, Sky188,

    you could simplify your procedure to this:
    Please Login or Register  to view this content.
    It depends if you need the value from A1 anywhere else and if you want the rows just to be hidden if there is 1 in the cell. This extra procedure needs to be called as well, and maybe you try to add the hiding directly to the checkbox like:
    Please Login or Register  to view this content.
    Ciao,
    Holger

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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