hassanleo1987
Board Regular
- Joined
- Apr 19, 2017
- Messages
- 56
Hi,
I have a multi-sheet file where I need custom page break based on pivot table refresh and last page of every sheet must be printed without repeated row headers.
Step-1: Change the date in Cell H2 and Refresh the pivot table. This will update the Data Table A5:I70 where are all cells are formulated from pivot table cache table. (Automatic calculation should be checked before this step in order to update the data table quickly)
Step-2: After refreshing the pivot table, check the formula blank rows at the end of data table and delete all the formula blank rows (marked "Delete row" here in the example), leaving last 2 rows of data table intact.
Step-3: The automatic page break will shift after deleting the formula blank rows. Check if the automatic page break is coming the in the fixed Range (A47:I63).
Step-4: If NO, then OK to save the file as PDF with current page setup / print area. (This way the fixed Range (A47:I63) comes nicely under the data table!)
Step-5: If YES, then move the last page break above ROW 47. remove the repeat row header only for the last page and save the file as PDF. (Since the actual data table will be a multipage setup).
As I have mentioned this is multisheet workbook but for the sake of example, here it is showing only one.
I can modify to added other sheets as required. because the step 2 ~ 5 will be repeated for next sheets and after the last specified sheet, an array of selected sheets wil be grouped and the file will be saved as PDF. (This I can handle myself!)
Please help with step 2 ~ 5 code!
Here is the example sheet.
I have a multi-sheet file where I need custom page break based on pivot table refresh and last page of every sheet must be printed without repeated row headers.
Step-1: Change the date in Cell H2 and Refresh the pivot table. This will update the Data Table A5:I70 where are all cells are formulated from pivot table cache table. (Automatic calculation should be checked before this step in order to update the data table quickly)
Step-2: After refreshing the pivot table, check the formula blank rows at the end of data table and delete all the formula blank rows (marked "Delete row" here in the example), leaving last 2 rows of data table intact.
Step-3: The automatic page break will shift after deleting the formula blank rows. Check if the automatic page break is coming the in the fixed Range (A47:I63).
Step-4: If NO, then OK to save the file as PDF with current page setup / print area. (This way the fixed Range (A47:I63) comes nicely under the data table!)
Step-5: If YES, then move the last page break above ROW 47. remove the repeat row header only for the last page and save the file as PDF. (Since the actual data table will be a multipage setup).
As I have mentioned this is multisheet workbook but for the sake of example, here it is showing only one.
I can modify to added other sheets as required. because the step 2 ~ 5 will be repeated for next sheets and after the last specified sheet, an array of selected sheets wil be grouped and the file will be saved as PDF. (This I can handle myself!)
Please help with step 2 ~ 5 code!
Here is the example sheet.
Example TS.xlsx | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | |||
1 | 1 | |||||||||||||
2 | 2 | Date : | 1-Oct | |||||||||||
3 | 3 | |||||||||||||
4 | A | B | C | D | E | F | G | H | I | Row Labels | ||||
5 | 10 | abc | abc | abc | abc | abc | abc | 10 | abc | 10 | ||||
6 | 20 | abc | abc | abc | abc | abc | abc | 20 | abc | 20 | ||||
7 | 30 | abc | abc | abc | abc | abc | abc | 30 | abc | 30 | ||||
8 | 40 | abc | abc | abc | abc | abc | abc | 40 | abc | 40 | ||||
9 | 50 | abc | abc | abc | abc | abc | abc | 50 | abc | 50 | ||||
10 | 60 | abc | abc | abc | abc | abc | abc | 60 | abc | 60 | ||||
11 | 70 | abc | abc | abc | abc | abc | abc | 70 | abc | 70 | ||||
12 | 1170 | abc | abc | abc | abc | abc | abc | 1170 | abc | 1170 | ||||
13 | 1180 | abc | abc | abc | abc | abc | abc | 1180 | abc | 1180 | ||||
14 | 1190 | abc | abc | abc | abc | abc | abc | 1190 | abc | 1190 | ||||
15 | 1200 | abc | abc | abc | abc | abc | abc | 1200 | abc | 1200 | ||||
16 | 1210 | abc | abc | abc | abc | abc | abc | 1210 | abc | 1210 | ||||
17 | 1220 | abc | abc | abc | abc | abc | abc | 1220 | abc | 1220 | ||||
18 | 1230 | abc | abc | abc | abc | abc | abc | 1230 | abc | 1230 | ||||
19 | 1240 | abc | abc | abc | abc | abc | abc | 1240 | abc | 1240 | ||||
20 | 1250 | abc | abc | abc | abc | abc | abc | 1250 | abc | 1250 | ||||
21 | 1260 | abc | abc | abc | abc | abc | abc | 1260 | abc | 1260 | ||||
22 | 1270 | abc | abc | abc | abc | abc | abc | 1270 | abc | 1270 | ||||
23 | 1280 | abc | abc | abc | abc | abc | abc | 1280 | abc | 1280 | ||||
24 | 1290 | abc | abc | abc | abc | abc | abc | 1290 | abc | 1290 | ||||
25 | 1300 | abc | abc | abc | abc | abc | abc | 1300 | abc | 1300 | ||||
26 | 1310 | abc | abc | abc | abc | abc | abc | 1310 | abc | 1310 | ||||
27 | 1320 | abc | abc | abc | abc | abc | abc | 1320 | abc | 1320 | ||||
28 | 1330 | abc | abc | abc | abc | abc | abc | 1330 | abc | 1330 | ||||
29 | 1340 | abc | abc | abc | abc | abc | abc | 1340 | abc | 1340 | ||||
30 | 1350 | abc | abc | abc | abc | abc | abc | 1350 | abc | 1350 | ||||
31 | 1360 | abc | abc | abc | abc | abc | abc | 1360 | abc | 1360 | ||||
32 | 1370 | abc | abc | abc | abc | abc | abc | 1370 | abc | 1370 | ||||
33 | 1380 | abc | abc | abc | abc | abc | abc | 1380 | abc | 1380 | ||||
34 | 1390 | abc | abc | abc | abc | abc | abc | 1390 | abc | 1390 | ||||
35 | 1400 | abc | abc | abc | abc | abc | abc | 1400 | abc | 1400 | ||||
36 | 1410 | abc | abc | abc | abc | abc | abc | 1410 | abc | 1410 | ||||
37 | 1420 | abc | abc | abc | abc | abc | abc | 1420 | abc | 1420 | ||||
38 | 1430 | abc | abc | abc | abc | abc | abc | 1430 | abc | 1430 | ||||
39 | 1440 | abc | abc | abc | abc | abc | abc | 1440 | abc | 1440 | ||||
40 | 1450 | abc | abc | abc | abc | abc | abc | 1450 | abc | 1450 | ||||
41 | 1460 | abc | abc | abc | abc | abc | abc | 1460 | abc | 1460 | ||||
42 | 1470 | abc | abc | abc | abc | abc | abc | 1470 | abc | 1470 | ||||
43 | Delete Row | |||||||||||||
44 | Delete Row | |||||||||||||
45 | Delete Row | |||||||||||||
46 | Delete Row | |||||||||||||
47 | Delete Row | |||||||||||||
48 | Delete Row | |||||||||||||
49 | Delete Row | |||||||||||||
50 | Delete Row | |||||||||||||
51 | Delete Row | |||||||||||||
52 | Delete Row | |||||||||||||
53 | Delete Row | |||||||||||||
54 | Delete Row | |||||||||||||
55 | Delete Row | |||||||||||||
56 | Delete Row | |||||||||||||
57 | Delete Row | |||||||||||||
58 | Delete Row | |||||||||||||
59 | Delete Row | |||||||||||||
60 | Delete Row | |||||||||||||
61 | Delete Row | |||||||||||||
62 | Delete Row | |||||||||||||
63 | Delete Row | |||||||||||||
64 | Delete Row | |||||||||||||
65 | Delete Row | |||||||||||||
66 | Delete Row | |||||||||||||
67 | Delete Row | |||||||||||||
68 | Delete Row | |||||||||||||
69 | ||||||||||||||
70 | ||||||||||||||
71 | Total | 41200 | ||||||||||||
72 | ||||||||||||||
73 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
74 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
75 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
76 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
77 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
78 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
79 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
80 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
81 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
82 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
83 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
84 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
85 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
86 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
87 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
88 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
89 | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | xyz | |||||
90 | ||||||||||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
H71 | H71 | =SUM(H5:H70) |