Multiple IFs in Private Sub Worksheet_Calculate() macro

nm079

New member
Joined
Sep 16, 2011
Messages
2
Reaction score
0
Points
0
Hi,


I am currently struggling with a Private Sub Worksheet_Calculate() macro.


I have 3 areas of my worksheet that I wish to hide / unhide under different conditions.


Unfortunately I am struggling to get 3 'IF' statements into the one sub - the first and third IF statements hide their targets, but the 2nd one does nothing when F94 = No


Here's what I have:

Private Sub Worksheet_Calculate()

If Range("B70").Value = "No" Then

Range("71:71", "73:73").EntireRow.Hidden = True

Else

Range("71:71", "73:73").EntireRow.Hidden = False


End If



If Range("F94").Value = "No" Then

Range("86:86", "92:92").EntireRow.Hidden = True

Else

Range("86:86", "92:92").EntireRow.Hidden = False

End If

If Range("E94").Value = "No" Then


Range("68:68", "75:75").EntireRow.Hidden = True
Range("84:84", "86:86").EntireRow.Hidden = True


Else

Range("68:68", "75:75").EntireRow.Hidden = False
Range("84:84", "86:86").EntireRow.Hidden = False


End If

End Sub




I have also tried nesting the IF commands - but unfortunately only one of the conditions seem to work.


If anybody could shed some light on this I'd be really grateful as I've spent the past 2 days banging my head against a brick wall!

I am using calculate event as the values are set by formulas and not by me typing into them.
 
Back
Top