D
DA
I know this macro doesn't work (bad syntax) and I also know there must
be more elegant ways to do this. Kindly help.
Sub HideUnusedHurdles()
If Range("NumberOfHurdles").Value = 4 Then GoTo 100
Else If Range("NumberOfHurdles").Value = 3 Then
Range("HideMonthlyRowsIfOnlyThreeHurdles").Select
Selection.EntireRow.Hidden = True
Range("HideQtrlyRowsIfOnlyThreeHurdles").Select
Selection.EntireRow.Hidden = True
Range("HideAnnualRowsIfOnlyThreeHurdles").Select
Selection.EntireRow.Hidden = True
GoTo 100
Else If Range("NumberOfHurdles").Value = 2 Then
Range("HideMonthlyRowsIfOnlyTwoHurdles").Select
Selection.EntireRow.Hidden = True
Range("HideQtrlyRowsIfOnlyTwoHurdles").Select
Selection.EntireRow.Hidden = True
Range("HideAnnualRowsIfOnlyTwoHurdles").Select
Selection.EntireRow.Hidden = True
GoTo 100
Else If Range("NumberOfHurdles").Value = 1 Then
Range("HideMonthlyRowsIfOnlyOneHurdle").Select
Selection.EntireRow.Hidden = True
Range("HideQtrlyRowsIfOnlyOneHurdle").Select
Selection.EntireRow.Hidden = True
Range("HideAnnualRowsIfOnlyOneHurdle").Select
Selection.EntireRow.Hidden = True
100
End If
End Sub
be more elegant ways to do this. Kindly help.
Sub HideUnusedHurdles()
If Range("NumberOfHurdles").Value = 4 Then GoTo 100
Else If Range("NumberOfHurdles").Value = 3 Then
Range("HideMonthlyRowsIfOnlyThreeHurdles").Select
Selection.EntireRow.Hidden = True
Range("HideQtrlyRowsIfOnlyThreeHurdles").Select
Selection.EntireRow.Hidden = True
Range("HideAnnualRowsIfOnlyThreeHurdles").Select
Selection.EntireRow.Hidden = True
GoTo 100
Else If Range("NumberOfHurdles").Value = 2 Then
Range("HideMonthlyRowsIfOnlyTwoHurdles").Select
Selection.EntireRow.Hidden = True
Range("HideQtrlyRowsIfOnlyTwoHurdles").Select
Selection.EntireRow.Hidden = True
Range("HideAnnualRowsIfOnlyTwoHurdles").Select
Selection.EntireRow.Hidden = True
GoTo 100
Else If Range("NumberOfHurdles").Value = 1 Then
Range("HideMonthlyRowsIfOnlyOneHurdle").Select
Selection.EntireRow.Hidden = True
Range("HideQtrlyRowsIfOnlyOneHurdle").Select
Selection.EntireRow.Hidden = True
Range("HideAnnualRowsIfOnlyOneHurdle").Select
Selection.EntireRow.Hidden = True
100
End If
End Sub