Okay so I am getting EXTREMELY frustrated with this, the code should work by all logic I possess but excel is having one of those demonic do what it wants moments.
In my row fields on the pivot tables I have dates, the values are like this 4/1/2009, all the way through this month 4/1/2011, each month is represented as a row.
I am trying to go through and hide all fields that are more than 8 months behind todays month. The problem is when vba takes the value for the month out of the field list (clearly written into the formula bar as I showed above)
It changes (for example) 4/1/2009 to 4/9/2011. For whatever reason it seems to be blindly swapping the day and year values. Obviously this totally ruins any attempts I make at using the date difference to do anything useful, as well as butchering my row labels.
All the formats work fine if i do it manually (change the date format by right clicking etc). It literally CHANGES the value in the formula bar at this point in the code ".PivotItems(x).Value = Format(.PivotItems(x).Value, "m/dd/yyyy")"
Like I said it seems to be interpreting my days as years and vice versa, but why?
Bookmarks