Results 1 to 3 of 3

Thread: Multiple IFs in Private Sub Worksheet_Calculate() macro

  1. #1

    Question Multiple IFs in Private Sub Worksheet_Calculate() macro



    Register for a FREE account, and/
    or Log in to avoid these ads!

    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.

  2. #2
    CXross-posted at Excel Forum where there is a very active response going on http://www.excelforum.com/excel-prog...ate-event.html

  3. #3
    Please can you close it Bob?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •