AndyMiller
New Member
- Joined
- Apr 22, 2022
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
Hi guys
I am creating a questionnaire, and have a populated a lot of questions from rows 32 to 53 in my worksheet. I am trying to run a code that hides certain rows depending on how you answer the drop down. The drop down has the following four options;
1 - Intangible Valuations
2 - Business Valuations
3 - Employee Incentive Schemes
Specific Procedures
I have put this code in however when I select the dropdown nothing happens, I don't get a code error but it also doesn't hide any rows:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 And Target.Row = 16 Then
If Target.Value = "1 - Intangible Valuations" Then
Application.Rows("39:53").Select
Application.Selection.EntireRow.Hidden = True
ElseIf Target.Value = "2 - Business Valuations" Then
Application.Rows("32:39,45:53").Select
Application.Selection.EntireRow.Hidden = True
ElseIf Target.Value = "3 - Employee Incentive Schemes" Then
Application.Rows("32:45").Select
Application.Selection.EntireRow.Hidden = True
ElseIf Target.Value = "Specific Procedures" Then
Application.Rows("32:53").Select
Application.Selection.EntireRow.Hidden = True
End If
End If
End Sub
Any help will be hugely appreciated!
I am creating a questionnaire, and have a populated a lot of questions from rows 32 to 53 in my worksheet. I am trying to run a code that hides certain rows depending on how you answer the drop down. The drop down has the following four options;
1 - Intangible Valuations
2 - Business Valuations
3 - Employee Incentive Schemes
Specific Procedures
I have put this code in however when I select the dropdown nothing happens, I don't get a code error but it also doesn't hide any rows:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 And Target.Row = 16 Then
If Target.Value = "1 - Intangible Valuations" Then
Application.Rows("39:53").Select
Application.Selection.EntireRow.Hidden = True
ElseIf Target.Value = "2 - Business Valuations" Then
Application.Rows("32:39,45:53").Select
Application.Selection.EntireRow.Hidden = True
ElseIf Target.Value = "3 - Employee Incentive Schemes" Then
Application.Rows("32:45").Select
Application.Selection.EntireRow.Hidden = True
ElseIf Target.Value = "Specific Procedures" Then
Application.Rows("32:53").Select
Application.Selection.EntireRow.Hidden = True
End If
End If
End Sub
Any help will be hugely appreciated!