Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Trouble with IF/AND Statement

mike703mike703 Posts: 2Member
Trying to understand whythis is not working properly...

[code]
If PT.ColumnFields("FM").PivotItems("2009/12").Visible = False And _
PT.ColumnFields("FM").PivotItems("2009/11").Visible = False And _
PT.ColumnFields("FM").PivotItems("2009/10").Visible = False And _
PT.ColumnFields("FM").PivotItems("2009/09").Visible = False Then
ActiveCell.Offset(24, 1).Select
Else
ActiveCell.Offset(0, 1).Select
End If
[/code]

The line of code is supposed to verify as to whether the above pivot items are visible under the "FM" pivot field (dosen't matter if pivot field or column field). There is a "2009/12" visible in the pivot table yet it ignores and computes as if it was not visible. Any idea what I may be doing wrong or possible another way of doing this?

Comments

  • mike703mike703 Posts: 2Member
    sounds odd, but code ended up working if i altered the code to appear as follows:

    [code]
    If PT.ColumnFields("FM").PivotItems("2009/12").Visible = True Then

    ActiveCell.Offset(0, 1).Select


    ElseIf PT.ColumnFields("FM").PivotItems("2009/12").Visible = False And _
    PT.ColumnFields("FM").PivotItems("2009/11").Visible = False And _
    PT.ColumnFields("FM").PivotItems("2009/10").Visible = False And _
    PT.ColumnFields("FM").PivotItems("2009/09").Visible = False Then

    ActiveCell.Offset(24, 1).Select

    End If
    [/code]
Sign In or Register to comment.