+ Reply to Thread
Results 1 to 5 of 5

Hide/Unhide rows and column based on cell value

  1. #1
    Forum Contributor
    Join Date
    01-08-2013
    Location
    Goergia USA
    MS-Off Ver
    Excel 2007
    Posts
    102

    Hide/Unhide rows and column based on cell value

    HI, I need your assistance with the following:

    When this Excel form is being filled out, columns H through M will be hidden and rows 9 through 21 will be hidden

    Here's what I need help with: (note: cells G5 and I5 are drop downs with Yes and No answers)

    If the user selects YES (cell G5), I need only rows G9:G21 to unhide
    If the user selects NO (cell G5), I need columns H and I to unhide, BUT rows I9:I21 to stay hidden

    THEN
    If the user selects YES (cell I5), I need rows I9:I21 to unhide
    If the user selects NO (cell I5), I need columns J through M to unhide

    Please Note: if I picked YES in cell G5 or I5 (by mistake), and then chose NO, I need Excel to toggle/revert back and hide rows G9:G21 (or I9:I21) once NO is picked

    Please see attached sample file.

    Any help is greatly appreciated! THANKS SO MUCH IN ADVANCE!
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Hide/Unhide rows and column based on cell value

    G9:G21 is not a set of rows, it is a range of cells in a single column. To get the cells G9:G21 to be hidden, you would have to hide the ENTIRE rows 9:21.

    To get the cell I9:I21 o be hidden, you would, again, have to hide the ENTIRE rows 9:21.

    So a macro that is hiding rows 9:21 based on the answer of two different cells would have to check them both all the time.

    Please Login or Register  to view this content.
    Your two sets of "needs" appear to be incompatible.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Hide/Unhide rows and column based on cell value

    Meanwhile, editing your existing macro, these tweaks seem to line up with your wants.
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    01-08-2013
    Location
    Goergia USA
    MS-Off Ver
    Excel 2007
    Posts
    102

    Re: Hide/Unhide rows and column based on cell value

    Thanks so much! I appreciate the help.

    Another followup question: I am using the following macro. Problem is, if I mistakenly choose Yes for G5, then choose No, the unhidden rows do not revert back to hidden rows. How can I manipulate the following code to toggle between Yes/No (Unhide/Hide)?

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    01-08-2013
    Location
    Goergia USA
    MS-Off Ver
    Excel 2007
    Posts
    102

    Re: Hide/Unhide rows and column based on cell value

    Thanks sooooo much!! This is exactly what I needed! You are awesome, JBeaucaire!

+ 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. [SOLVED] Macro to unhide & hide rows based on column value
    By qvfr034 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-15-2020, 03:00 PM
  2. Hide/Unhide rows and column based on cell value
    By marshak in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 03-10-2020, 08:41 PM
  3. [SOLVED] Need Help with Hide/Unhide Rows Based on Zero Value in Column
    By amyly2n in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-31-2019, 03:43 PM
  4. Automatically hide/unhide rows based on column A value
    By c.bernardo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-14-2017, 12:30 AM
  5. Hide/Unhide Rows based on column data using checkbox
    By ricklberry in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-27-2015, 11:39 AM
  6. [SOLVED] VBA macro that hide and unhide column to respective rows based on first column value
    By janine6192 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-14-2013, 06:21 PM
  7. Macro to Hide/Unhide Rows Based on Results in Column Equation
    By jwhite0720 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-11-2011, 04:59 PM

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