+ Reply to Thread
Results 1 to 2 of 2

IF based on date

  1. #1
    flow23
    Guest

    IF based on date

    I have a macro which is fine. But part of it has to be done manually.

    e.g. when the new financial year begins..(01st April of each year)

    a new field needs to be addded ( in this case I added manually 2005)

    With ActiveSheet.Pivottables("a1").PivotFields("Campaign year")
    ..Orientation = xlPageField
    ..Position = 1
    ..PivotItems("2005").Visible = False
    ..PivotItems("2004").Visible = False
    ..PivotItems("pre 2004").Visible = False
    End With

    Is it possible to write a if statement where it checks for date and hide the
    pivotitems accordingly?


  2. #2
    Forum Contributor
    Join Date
    12-04-2003
    Posts
    360
    evaluate the year you need...

    Create a string variable to hold the year.
    Then format the date to a year and place in the variable.

    strYear = year(date)

    then cycle thru the pivotitems and if not equal to stryear then visible = false.

+ 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