ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Programmatically set print area in Excel (https://www.excelbanter.com/excel-programming/374406-programmatically-set-print-area-excel.html)

msunder

Programmatically set print area in Excel
 
I have a spreadsheet that contains accuracy information for projects
based. Column A is the date column and columns B-BF are for reporting
pass/fail results for several workgroups. The top 3 rows contain the
sums of pass/fail, the percent of pass, and the workgroup name.

I would like to be able to set the print area to programmatically
decide the last 10 working days worth of information to print.

Any assistance would be appreciated.


[email protected]

Programmatically set print area in Excel
 
If the working days/dates in Column A in ascending order:

Sub SetPrintArea()
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, 1).End(xlUp).Row
Cells(Lastrow - 9, 1).Resize(10, 58).Select
ActiveSheet.PageSetup.PrintArea = Selection

End Sub

msunder wrote:
I have a spreadsheet that contains accuracy information for projects
based. Column A is the date column and columns B-BF are for reporting
pass/fail results for several workgroups. The top 3 rows contain the
sums of pass/fail, the percent of pass, and the workgroup name.

I would like to be able to set the print area to programmatically
decide the last 10 working days worth of information to print.

Any assistance would be appreciated.




All times are GMT +1. The time now is 05:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com