A
andy
Someone must have already encountered this and written
code. Please help me with this. A macro (I'll put a menu
button on the tool bar) will be fine.
In one single column (e.g. A) I would like the code to
look at a cell (e.g. beginning with B10) and compare the
value in B10 to the value directly below it (B11). If it
is different I would like a page break to be inserted. If
it is the same, the code should move on (compare B11 to
B12...).
It would be like programmatically inserting page breaks
at "group by" levels.
Some things to overcome:
1)Empty cells should be ignored (no page break just
because the previous cell had values and the active cell
is blank).
2) Also all cells with text letters should be ignored
(again no page break just because it is different)
A second macro to remove all page breaks (get ready for
the next set of data) would be very helpful too.
Here is an exampele with data and actions I would like:
A1 100101
A2 100101 no change (A1 = A2)
A3 100101
A4 200222 insert page break (A3 <> A4)
A5 200501 insert page break (A4 <> A5)
A6 200501
A7 200501
A8 no change (blank line)
A9 no change (blank line)
A10 Sales division: no change (text in cells)
A11 300101 insert page break (A7 <> A11)
A12 300101
A13 300501 insert page break (A12 <> A13)
Thank you in advance
God bless you
code. Please help me with this. A macro (I'll put a menu
button on the tool bar) will be fine.
In one single column (e.g. A) I would like the code to
look at a cell (e.g. beginning with B10) and compare the
value in B10 to the value directly below it (B11). If it
is different I would like a page break to be inserted. If
it is the same, the code should move on (compare B11 to
B12...).
It would be like programmatically inserting page breaks
at "group by" levels.
Some things to overcome:
1)Empty cells should be ignored (no page break just
because the previous cell had values and the active cell
is blank).
2) Also all cells with text letters should be ignored
(again no page break just because it is different)
A second macro to remove all page breaks (get ready for
the next set of data) would be very helpful too.
Here is an exampele with data and actions I would like:
A1 100101
A2 100101 no change (A1 = A2)
A3 100101
A4 200222 insert page break (A3 <> A4)
A5 200501 insert page break (A4 <> A5)
A6 200501
A7 200501
A8 no change (blank line)
A9 no change (blank line)
A10 Sales division: no change (text in cells)
A11 300101 insert page break (A7 <> A11)
A12 300101
A13 300501 insert page break (A12 <> A13)
Thank you in advance
God bless you