Hide Rows based on Cell value

therealjdj

New Member
Joined
Jul 8, 2013
Messages
20
Office Version
  1. 365
Platform
  1. Windows
Hey folks,
I am creating an excel form that will be used to fill out some data. Based on the data being entered I might require additional information entered in other cells.

So I need help hiding rows based on values of other cells. Let's say cell B5 is "no" then I might want to hide rows 15-20. And if cell B7 is "yes" then maybe rows 26-31 have to be hidden...
Now there could be 5 of these situations. So it's not just these 2 - they were just an example.
I would like for these things to happen automatically and not after pushing a button.

Thank you for any help!

I did find some other posts asking a similar questions, but nothing that really did what I needed.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Was able to find an answer!
Values aren't the same as I stated above, but this code works.

Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Activate
If Not Application.Intersect(Range("C5"), Range(Target.Address)) Is Nothing Then
Select Case Target.Value
Case Is = "Canada": Rows("19:25").EntireRow.Hidden = True
Rows("7:18").EntireRow.Hidden = False
Case Is = "India": Rows("19:25").EntireRow.Hidden = False
Rows("7:18").EntireRow.Hidden = True
Case Is = "": Rows("19:25").EntireRow.Hidden = False
Rows("7:18").EntireRow.Hidden = False

End Select
End If
 
Upvote 0
Solution

Forum statistics

Threads
1,214,567
Messages
6,120,268
Members
448,953
Latest member
Dutchie_1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top