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
 

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
41,087
Office Version
365
Platform
Windows
It would help if you showed the entire code, rather than just the bit that works. ;)
 

ERed1

Board Regular
Joined
Jun 26, 2019
Messages
104
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
 

ERed1

Board Regular
Joined
Jun 26, 2019
Messages
104
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.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
41,087
Office Version
365
Platform
Windows
Are both of those codes in the same procedure?
 

ERed1

Board Regular
Joined
Jun 26, 2019
Messages
104
As in the same Worksheet Change? Because if so then yes.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
41,087
Office Version
365
Platform
Windows
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
 

ERed1

Board Regular
Joined
Jun 26, 2019
Messages
104
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!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
41,087
Office Version
365
Platform
Windows
You're welcome & thanks for the feedback
 

Watch MrExcel Video

Forum statistics

Threads
1,099,773
Messages
5,470,699
Members
406,718
Latest member
waseem11

This Week's Hot Topics

Top