Trouble with IF/AND Statement - Programmers Heaven

Howdy, Stranger!

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

Categories

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.