Hi all.
I have two private subs, they work when i run them alone but i am having trouble combining them
The function of the code is id you select a value in d15 it would unhide rows depending on the value so select the number one and it hides the 14 rows below
Then move onto d16 and the axact same principal applies
First code
If Intersect(Target, Range("D15")) Is Nothing Or Target.Cells.Count > 20 Then
Exit Sub
ElseIf Range("D15").Value = "15" Then
Rows("25:39").EntireRow.Hidden = False
ElseIf Range("D15").Value = "1" Then
Rows("25").EntireRow.Hidden = False
Rows("26:39").EntireRow.Hidden = True
End If
End Sub
Second Code
if Intersect(Target, Range("D16")) Is Nothing Or Target.Cells.Count > 20 Then
Exit Sub
ElseIf Range("D15").Value = "D16" Then
Rows("41:57").EntireRow.Hidden = False
ElseIf Range("D16").Value = "1" Then
Rows("41").EntireRow.Hidden = False
Rows("42:57").EntireRow.Hidden = True
End If
End Sub
I would greatly appreciate any help
I have two private subs, they work when i run them alone but i am having trouble combining them
The function of the code is id you select a value in d15 it would unhide rows depending on the value so select the number one and it hides the 14 rows below
Then move onto d16 and the axact same principal applies
First code
If Intersect(Target, Range("D15")) Is Nothing Or Target.Cells.Count > 20 Then
Exit Sub
ElseIf Range("D15").Value = "15" Then
Rows("25:39").EntireRow.Hidden = False
ElseIf Range("D15").Value = "1" Then
Rows("25").EntireRow.Hidden = False
Rows("26:39").EntireRow.Hidden = True
End If
End Sub
Second Code
if Intersect(Target, Range("D16")) Is Nothing Or Target.Cells.Count > 20 Then
Exit Sub
ElseIf Range("D15").Value = "D16" Then
Rows("41:57").EntireRow.Hidden = False
ElseIf Range("D16").Value = "1" Then
Rows("41").EntireRow.Hidden = False
Rows("42:57").EntireRow.Hidden = True
End If
End Sub
I would greatly appreciate any help