Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need to select a rolling 12 months of data when I select a chart. The field I need to select on is YrMonth which is in the format 12012-01.
sub SetRolling12Mo
ActiveDocument.Fields("YrMonth").Clear
ActiveDocument.Fields("YrMonth").Select "<=" & Year(now()) & "-" & Month(now())
end sub
Any help woudl be appreciated.
hei
i findit a best practice to have a field in the calnder , monthyear which have the value monthtart of every date
i.e all dates are 01/012012 , 01/12/2011.....
then in your case i would define a varaible with the formula =addmonths(max(monthyear),-11)
then in the macro use this
sub SetRolling12Mo
ActiveDocument.Fields("monthyear").Clear
ActiveDocument.Fields("monthyear").Select ">=" & varaible
end sub
I have also a problem with this? can someone help me.