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

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Paulo1

Thread Starter
Joined
Jan 16, 2019
Messages
1
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
 

Keebellah

Trusted Advisor
Joined
Mar 27, 2008
Messages
6,611
First Name
Hans
Hi, welcome,

It would be code like this after the C40 check
Code:
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 
Endif
You will have to check the syntax but something like this
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Members online

Top