+ Reply to Thread
Results 1 to 4 of 4

Hide/show row based on cell value

  1. #1
    Registered User
    Join Date
    02-02-2014
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    37

    Hide/show row based on cell value

    Hi, could somebody write a VBA script that does the following please?
    • If 'Yes' is selected in A1 (Sheet 1), row 3 is shown in Sheet 2; if 'No' is selected, row 3 is hidden.
    • If 'Yes' is selected in A2 (Sheet 1), row 5 is shown in Sheet 2; if 'No' is selected, row 5 is hidden.

    Both A1 and A2 will be 'No' upon opening the spreadsheet and the rows will be hidden by default (I don't know if this is significant or not).

    Thank you very much!
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Hide/show row based on cell value

    paste this on sheet1;
    Please Login or Register  to view this content.
    Please click the * Add Reputation if this helps
    If solved remember to mark Thread as solved

    "I'm glad to help and this is not meant to sound smart, but either you have super-human vision to see all those controls cleared one by one with the code I posted, or your computer is really slow."

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,872

    Re: Hide/show row based on cell value

    In addition to Blokeman's code, add this to the Workbook_Open Event

    Please Login or Register  to view this content.
    to take care of this part of your request

    Both A1 and A2 will be 'No' upon opening the spreadsheet and the rows will be hidden by default
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    02-02-2014
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    37

    Re: Hide/show row based on cell value

    Thank you both! They work perfectly.

+ 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 Or Show An Image Based On A Cell Value
    By kc27315 in forum Excel General
    Replies: 21
    Last Post: 06-12-2023, 03:55 AM
  2. Hide/Show Columns based on Cell Value
    By Woodjr in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-05-2013, 04:12 AM
  3. Need help to show/hide rows based on values from a cell
    By concurmgr in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-19-2012, 02:56 PM
  4. [SOLVED] Hide/Show rows based on the value in a cell
    By PatRiot199 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-11-2012, 11:52 PM
  5. [SOLVED] Hide/Show Command button based on cell value
    By paxile2k in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-13-2010, 08:59 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