VBA

Moderators: PavlinII
Number of threads: 1673
Number of posts: 3078

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Trouble with IF/AND Statement Posted by mike703 on 8 Mar 2010 at 2:17 PM
Trying to understand whythis is not working properly...

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


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?
Report
Re: Trouble with IF/AND Statement Posted by mike703 on 8 Mar 2010 at 2:26 PM
sounds odd, but code ended up working if i altered the code to appear as follows:

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




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.