+ Reply to Thread
Results 1 to 3 of 3

Help with macro

Hybrid View

  1. #1
    Mike W
    Guest

    Help with macro

    I have the following macro which hides the "blank" field in the pivot table
    but only works when there is data in the Pivot field, if there is not I get
    an error. What I need is an IF statement to accomodate this possibility.
    Help would be much appreciated.

    thanks,

    Mike


    With ActiveSheet.PivotTables("INDUSTRIAL").PivotFields("INTERNAL ORDER
    No:")
    .PivotItems("(blank)").Visible = False
    End With
    With ActiveSheet.PivotTables("RETAIL").PivotFields("INTERNAL ORDER No:")
    .PivotItems("(blank)").Visible = False
    End With
    With ActiveSheet.PivotTables("WAL").PivotFields("INTERNAL ORDER No:")
    .PivotItems("(blank)").Visible = False
    End With
    End Sub



  2. #2
    Bob Umlas
    Guest

    Re: Help with macro

    Precede the code with
    On Error Resume Next

    "Mike W" <mike@ehb-docks.fsbusiness.co.uk> wrote in message
    news:ddshqu$6lu$1@newsm1.svr.pol.co.uk...
    > I have the following macro which hides the "blank" field in the pivot

    table
    > but only works when there is data in the Pivot field, if there is not I

    get
    > an error. What I need is an IF statement to accomodate this possibility.
    > Help would be much appreciated.
    >
    > thanks,
    >
    > Mike
    >
    >
    > With ActiveSheet.PivotTables("INDUSTRIAL").PivotFields("INTERNAL ORDER
    > No:")
    > .PivotItems("(blank)").Visible = False
    > End With
    > With ActiveSheet.PivotTables("RETAIL").PivotFields("INTERNAL ORDER

    No:")
    > .PivotItems("(blank)").Visible = False
    > End With
    > With ActiveSheet.PivotTables("WAL").PivotFields("INTERNAL ORDER No:")
    > .PivotItems("(blank)").Visible = False
    > End With
    > End Sub
    >
    >




  3. #3
    Mike W
    Guest

    Re: Help with macro

    Bob, many thanks. Why do I always forget the obvious?

    Mike


    "Bob Umlas" <Excel_Trickster@msn.com> wrote in message
    news:uQj4E%23ooFHA.2956@TK2MSFTNGP10.phx.gbl...
    > Precede the code with
    > On Error Resume Next
    >
    > "Mike W" <mike@ehb-docks.fsbusiness.co.uk> wrote in message
    > news:ddshqu$6lu$1@newsm1.svr.pol.co.uk...
    > > I have the following macro which hides the "blank" field in the pivot

    > table
    > > but only works when there is data in the Pivot field, if there is not I

    > get
    > > an error. What I need is an IF statement to accomodate this

    possibility.
    > > Help would be much appreciated.
    > >
    > > thanks,
    > >
    > > Mike
    > >
    > >
    > > With ActiveSheet.PivotTables("INDUSTRIAL").PivotFields("INTERNAL ORDER
    > > No:")
    > > .PivotItems("(blank)").Visible = False
    > > End With
    > > With ActiveSheet.PivotTables("RETAIL").PivotFields("INTERNAL ORDER

    > No:")
    > > .PivotItems("(blank)").Visible = False
    > > End With
    > > With ActiveSheet.PivotTables("WAL").PivotFields("INTERNAL ORDER

    No:")
    > > .PivotItems("(blank)").Visible = False
    > > End With
    > > End Sub
    > >
    > >

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1