Rows Keep Unhiding

ERed1

Board Regular
Joined
Jun 26, 2019
Messages
104
Hey everyone,

So in my worksheet I have a lot of drop downs. Some are dependent on some are not. A few of the rows I have hide if "No" is selected in the drop down. After I use another drop down, the row un-hides itself. Does anyone have a solution to this issue?

Thanks in advance.

Here is a clip of the code that is hiding the rows:
If Target.Column = 2 And Target.Row = 55 Then
If Target.Value = "No" Then
Application.Rows("56").Select
Application.Selection.EntireRow.Hidden = True
ElseIf Target.Value = "Yes" Then
Application.Rows("56").Select
Application.Selection.EntireRow.Hidden = False
End If
End If
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
It would help if you showed the entire code, rather than just the bit that works. ;)
 
Upvote 0
There is a lot of code lol. So here it is for the section. I think I just figure it out, but I don't know how I would fix it. Here is the Code


'Hide Cells'
If Range("B16").Value = "Pizza" Then
Rows("21:49").EntireRow.Hidden = True
Rows("50:65").EntireRow.Hidden = False
Rows("66:129").EntireRow.Hidden = True
End If



If Target.Column = 2 And Target.Row = 55 Then
If Target.Value = "No" Then
Application.Rows("56").Select
Application.Selection.EntireRow.Hidden = True
ElseIf Target.Value = "Yes" Then
Application.Rows("56").Select
Application.Selection.EntireRow.Hidden = False
End If
End If
 
Upvote 0
The Row that keeps appear is 56, but I know that is because of the way I have the rows staying appeared from the first code.
 
Upvote 0
Are both of those codes in the same procedure?
 
Upvote 0
In that case try
Code:
If Range("B16").Value = "Pizza" Then
   Rows("21:49").EntireRow.Hidden = True
   Rows("50:65").EntireRow.Hidden = False
   Rows("66:129").EntireRow.Hidden = True
   If Range("B55").Value = "No" Then Rows(56).Hidden = True
End If
 
Upvote 0
In that case try
Code:
If Range("B16").Value = "Pizza" Then
   Rows("21:49").EntireRow.Hidden = True
   Rows("50:65").EntireRow.Hidden = False
   Rows("66:129").EntireRow.Hidden = True
   If Range("B55").Value = "No" Then Rows(56).Hidden = True
End If


That worked Perfectly! Thank you!
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,531
Messages
6,120,073
Members
448,943
Latest member
sharmarick

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