I am fairly new to Macros and have a problem that I think can be easily solved but need some experience to help.
The task: 1. Search a range of rows to determine if an automatic page break occurs. 2. If yes, place a manual page break at before the first row in the range. 3. Repeat task for other ranges or groups of rows.
I have written code that works but is fairly long and is going to take me along time to write considering that amount of groups of rows that I have. The code for 1 group looks like this;
I have tried to rewrite the code like this but it only searches the first row in the range (in this case row 54);
Can any one tell me what I am doing wrong?
The task: 1. Search a range of rows to determine if an automatic page break occurs. 2. If yes, place a manual page break at before the first row in the range. 3. Repeat task for other ranges or groups of rows.
I have written code that works but is fairly long and is going to take me along time to write considering that amount of groups of rows that I have. The code for 1 group looks like this;
Code:
If Rows(54).PageBreak = xlPageBreakAutomatic Or Rows(55).PageBreak = xlPageBreakAutomatic Or Rows(56).PageBreak = xlPageBreakAutomatic Then
Rows(53).PageBreak = xlPageBreakManual
End If
I have tried to rewrite the code like this but it only searches the first row in the range (in this case row 54);
Code:
If Rows("54:56").PageBreak = xlPageBreakAutomatic Then
'Rows(53).PageBreak = xlPageBreakManual
End If
Can any one tell me what I am doing wrong?