I have a spreadsheet with dates across row 1 and information related to the dates in the columns below. The cells are formatted to show month and year (so it shows July-12 for this month with the actual date entered being 7/1/12).
I want to auto set the print area, upon sheet activation, so that it sets the print area as the columns for the 12 previous months before the current month's column. So I was thinking I would set the print area range by starting with the cell that has a date < Date & >= Date - 28 then offsetting -12 columns and -86 rows. However, I am struggling with the code to find and reference the cell with the previous month's date as mentioned.
Any thoughts/experience you can share is appreciated!
Example, this month I would want to set the print area as the months & their columns that are in blue below:[TABLE="width: 500"]
<TBODY>[TR]
[TD]7/1/11[/TD]
[TD]8/1/11[/TD]
[TD]9/1/11[/TD]
[TD]10/1/11[/TD]
[TD]11/1/11[/TD]
[TD]12/1/11[/TD]
[TD]1/1/12[/TD]
[TD]2/1/12[/TD]
[TD]3/1/12[/TD]
[TD]4/1/12[/TD]
[TD]5/1/12[/TD]
[TD]6/1/12[/TD]
[TD]7/1/12[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]120[/TD]
[TD]127[/TD]
[TD]129[/TD]
[TD]129[/TD]
[TD]135[/TD]
[TD]137[/TD]
[TD]141[/TD]
[TD]138[/TD]
[TD]131[/TD]
[TD]140[/TD]
[TD]129[/TD]
[TD]136[/TD]
[/TR]
[TR]
[TD]1y[/TD]
[TD]1y[/TD]
[TD]3n[/TD]
[TD]4y[/TD]
[TD]8n[/TD]
[TD]11n[/TD]
[TD]12y[/TD]
[TD]16y[/TD]
[TD]13n[/TD]
[TD]11n[/TD]
[TD]12y[/TD]
[TD]13n[/TD]
[TD]13n[/TD]
[/TR]
</TBODY>[/TABLE]
I want to auto set the print area, upon sheet activation, so that it sets the print area as the columns for the 12 previous months before the current month's column. So I was thinking I would set the print area range by starting with the cell that has a date < Date & >= Date - 28 then offsetting -12 columns and -86 rows. However, I am struggling with the code to find and reference the cell with the previous month's date as mentioned.
Any thoughts/experience you can share is appreciated!
Example, this month I would want to set the print area as the months & their columns that are in blue below:[TABLE="width: 500"]
<TBODY>[TR]
[TD]7/1/11[/TD]
[TD]8/1/11[/TD]
[TD]9/1/11[/TD]
[TD]10/1/11[/TD]
[TD]11/1/11[/TD]
[TD]12/1/11[/TD]
[TD]1/1/12[/TD]
[TD]2/1/12[/TD]
[TD]3/1/12[/TD]
[TD]4/1/12[/TD]
[TD]5/1/12[/TD]
[TD]6/1/12[/TD]
[TD]7/1/12[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]120[/TD]
[TD]127[/TD]
[TD]129[/TD]
[TD]129[/TD]
[TD]135[/TD]
[TD]137[/TD]
[TD]141[/TD]
[TD]138[/TD]
[TD]131[/TD]
[TD]140[/TD]
[TD]129[/TD]
[TD]136[/TD]
[/TR]
[TR]
[TD]1y[/TD]
[TD]1y[/TD]
[TD]3n[/TD]
[TD]4y[/TD]
[TD]8n[/TD]
[TD]11n[/TD]
[TD]12y[/TD]
[TD]16y[/TD]
[TD]13n[/TD]
[TD]11n[/TD]
[TD]12y[/TD]
[TD]13n[/TD]
[TD]13n[/TD]
[/TR]
</TBODY>[/TABLE]