tlc53
Active Member
- Joined
- Jul 26, 2018
- Messages
- 399
Hi there,
Not had to write a code like this so have taken a stab in the dark but it's not liking it. Can anyone see where I am going wrong please? When I try to run it, the error highlights the second row of code (If Not Intersect...)
The "Entity_Type" is located in cell D8. The "Entity Type" is selected on another sheet by a drop down and just transferred over to this sheet.
I'm trying to hide/unhide rows depending on whether the Entity Type is Company or not.
Thank you!
Not had to write a code like this so have taken a stab in the dark but it's not liking it. Can anyone see where I am going wrong please? When I try to run it, the error highlights the second row of code (If Not Intersect...)
The "Entity_Type" is located in cell D8. The "Entity Type" is selected on another sheet by a drop down and just transferred over to this sheet.
I'm trying to hide/unhide rows depending on whether the Entity Type is Company or not.
Thank you!
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("Entity_Type")) Is Nothing Then
If Target.Cells.CountLarge > 1 Then Exit Sub
Select Case Target.Value
Case Is <> "Company"
Range("26:29:,52:88").EntireRow.Hidden = True
Case "Company"
Range("26:29:,52:88").EntireRow.Hidden = False
End Select
End If
End Sub