It's been a while but I am back again. I am playing with the same cards; a solid excel user and a psuedo-neophyte in VBA.
I am trying to automate the pagination of a report compiled by combining sub-reports generated from a large data set on another sheet in the same workbook. My issue is I cannot get VBA to recognize the content of a specific cell then apply a page break to the blank cell above the specific cell.
This is a screen grab of where the code below does not work. The page break at row 348 is an auto page break and is not replace by a hard page break in the blank cell in the row above.
Capture.PNG
The following is my short macro I cobbled together without shame of plagiarizing. I believe the If rng.Value = "Report Date:" Then code line is the issue possibly stemming from a total lack of syntax wisdom or some misguided declarative statements above.
The basic repagination logic is based on the predetermined format of the sub-reports and is:
If the automatic page break is on a blank cell, that is good, skip out.Else if the automatic page break falls at a cell containing the text "Report Date:", put a page break in the blank cell immediately above the current then on to the next auto page break
Else if the auto page break cell text is anything other than "Report Date:", CRTL up once to the cell below the next blank up
If that cell text is "Report Date:", put a page break in the blank cell immediately above the current then on to the next auto page break
Many regrets on the long post but I felt my distilled question might be lost without sufficient explanation. In advance, thanks to the entire for any help offered here and for all the times I've signed on and found necessary solution without posting.
Bookmarks