1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Excel - Auto Unhide and Hide Rows based on a cell value

Discussion in 'Business Applications' started by Paulo1, Jan 16, 2019.

  1. Paulo1

    Paulo1 Thread Starter

    Jan 16, 2019
    Hi All,

    I have had a look around this site for help and found similar posts but nothing exact or that i can get to work. I'm working on Excel 2010 and i want to do the following unhide or hide a value based on a cell value e.g. -

    If Cell "C40" = Yes

    Unhide Rows 42 - 47

    If Cell "C40" = No or BLANK

    Hide Rows 42 - 47

    Any help would be much appreciated, I assume this needs to be done in VB by right clicking on the sheet>>Show Code then adding it in. Do you just save then and it should work automatically ?

    Thank you
  2. Keebellah

    Keebellah Trusted Advisor

    Mar 27, 2008
    First Name:
    Hi, welcome,

    It would be code like this after the C40 check
    If range("C40").value = "Yes" Then 
          Range("A42:A47").EntireRow.Visible = False 
    ElseIf len(trim(range("C40").value))=0   Then 
          Range("A42:A47").EntireRow.Visible = true 
    You will have to check the syntax but something like this
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!


Short URL to this thread: https://techguy.org/1221954

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice