Multiple Hide Rows Based on Different Cell Values

DebKshort

New Member
Joined
Apr 9, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
The top portion works when alone. But when I try to add the second one, nothing works. I thank you all, in advance.
I want to set up 6 sets, with each operatinge independently of the same sheet.

Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Activate
If Not Application.Intersect(Range("F2"), Range(Target.Address)) Is Nothing Then
Select Case Target.Value
Case Is = "No": Rows("62:74").EntireRow.Hidden = True
Case Is = "Yes": Rows("62:74").EntireRow.Hidden = False

If Not Application.Intersect(Range("F3"), Range(Target.Address)) Is Nothing Then
Select Case Target.Value
Case Is = "No": Rows("76:88").EntireRow.Hidden = True
Case Is = "Yes": Rows("76:88").EntireRow.Hidden = False
End Select
End If
End Sub
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hi & welcome to MrExcel.
How about
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   If Target.CountLarge > 1 Then Exit Sub
   If Not Intersect(Target, Range("F2:F7")) Is Nothing Then
      Select Case Target.Address(0, 0)
         Case "F2"
            Rows("62:74").Hidden = Target.Value = "No"
         Case "F3"
            Rows("76:88").Hidden = Target.Value = "No"
      End Select
   End If
End Sub
 
Upvote 0
Hi & welcome to MrExcel.
How about
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   If Target.CountLarge > 1 Then Exit Sub
   If Not Intersect(Target, Range("F2:F7")) Is Nothing Then
      Select Case Target.Address(0, 0)
         Case "F2"
            Rows("62:74").Hidden = Target.Value = "No"
         Case "F3"
            Rows("76:88").Hidden = Target.Value = "No"
      End Select
   End If
End Sub


This worked perfectly. Thank you so much!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,078
Latest member
skydd

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