ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   dyamic printing (https://www.excelbanter.com/excel-programming/416833-dyamic-printing.html)

hurlbut777

dyamic printing
 
I have a spreadsheet with 10,000 rows available for entry. I would like to
create a print macro that would only print down to the last row that actually
had data instead of printing 1 billion pages of blank rows.

I need to know if this is possible using vba, and if so, what would the code
look like...not looking for alternative solutions.

Thanks,
Jeff

NOPIK

dyamic printing
 
On Sep 10, 7:55*pm, hurlbut777
wrote:
I have a spreadsheet with 10,000 rows available for entry. *I would like to
create a print macro that would only print down to the last row that actually
had data instead of printing 1 billion pages of blank rows.

I need to know if this is possible using vba, and if so, what would the code
look like...not looking for alternative solutions.

Thanks,
Jeff


Setup PrintArea as described in following post
ActiveSheet.PageSetup.PrintArea = "1:100"
ActiveSheet.PrintOut

Office_Novice

dyamic printing
 
Option Explicit
Sub PrintYourRange()
Dim LastRow As Long
Dim YourRange As Range
LastRow = ActiveWorkbook.Worksheets(1).Cells(Rows.Count, 1).End(xlUp).Row
Set YourRange = Range("A1: I" & LastRow)
YourRange.Select
Selection.PrintOut
End Sub

"NOPIK" wrote:

On Sep 10, 7:55 pm, hurlbut777
wrote:
I have a spreadsheet with 10,000 rows available for entry. I would like to
create a print macro that would only print down to the last row that actually
had data instead of printing 1 billion pages of blank rows.

I need to know if this is possible using vba, and if so, what would the code
look like...not looking for alternative solutions.

Thanks,
Jeff


Setup PrintArea as described in following post
ActiveSheet.PageSetup.PrintArea = "1:100"
ActiveSheet.PrintOut



All times are GMT +1. The time now is 02:54 AM.

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