Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello All
Got a calendar all on one worksheet. It puts each date in like this: CELL A1: =DATE(year, 1,1), A2: =A1+1, A3: =A2+1, etc. I want to print it out with each month on a separate piece of paper. I can't put the page breaks in manually because in leap years I'll end up with 29 Feb on the top of the March page, 31 Mar on the top of the April page, etc, etc. How can I get the page breaks to go in so that they'll always separate the months right for every year? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Am Sat, 29 Dec 2012 12:23:09 -0800 (PST) schrieb robzrob: Got a calendar all on one worksheet. It puts each date in like this: CELL A1: =DATE(year, 1,1), A2: =A1+1, A3: =A2+1, etc. I want to print it out with each month on a separate piece of paper. I can't put the page breaks in manually because in leap years I'll end up with 29 Feb on the top of the March page, 31 Mar on the top of the April page, etc, etc. How can I get the page breaks to go in so that they'll always separate the months right for every year? try: Sub PageBreaks() Dim i As Integer Dim LRow As Integer With ActiveSheet LRow = .Cells(.Rows.Count, 1).End(xlUp).Row For i = 2 To LRow If Month(.Cells(i, 1)) Month(.Cells(i - 1, 1)) Then .HPageBreaks.Add .Cells(i, 1) End If Next End With End Sub Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Saturday, 29 December 2012 20:36:54 UTC, Claus Busch wrote:
Hi, Am Sat, 29 Dec 2012 12:23:09 -0800 (PST) schrieb robzrob: Got a calendar all on one worksheet. It puts each date in like this: CELL A1: =DATE(year, 1,1), A2: =A1+1, A3: =A2+1, etc. I want to print it out with each month on a separate piece of paper. I can't put the page breaks in manually because in leap years I'll end up with 29 Feb on the top of the March page, 31 Mar on the top of the April page, etc, etc. How can I get the page breaks to go in so that they'll always separate the months right for every year? try: Sub PageBreaks() Dim i As Integer Dim LRow As Integer With ActiveSheet LRow = .Cells(.Rows.Count, 1).End(xlUp).Row For i = 2 To LRow If Month(.Cells(i, 1)) Month(.Cells(i - 1, 1)) Then .HPageBreaks.Add .Cells(i, 1) End If Next End With End Sub Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 Tried it with 2013 and 2016. Works fine. Thank you. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Average between dates considering leap years. | Excel Discussion (Misc queries) | |||
Does the Networkdays function allow for leap years | Excel Worksheet Functions | |||
How does Excel allow for leap years? | Excel Worksheet Functions | |||
Non Leap Years I want to show 28, leap years show 29 in an"IF" | Excel Worksheet Functions | |||
DATEDIF and leap years | New Users to Excel |