Macro print range
I have a spread sheet that I would like to print columns
D to J starting with row 10. The number of rows that have information in them will be different every time. I would only like to print the number of rows that have data in them. Please help me with writting a macro to preform this action. Thank you very much. |
Macro print range
One way:
Public Sub PrintDtoJ() Dim nLastRow As Long Dim i As Long nLastRow = 10 For i = 4 to 10 nLastRow = Application.Max(nLastRow, _ Cells(Rows.Count, i).End(xlUp).Row) Next i With ActiveSheet .PageSetup.PrintArea = "D10:J" & nLastRow .PrintOut End With End Sub In article , "Shawn" wrote: I have a spread sheet that I would like to print columns D to J starting with row 10. The number of rows that have information in them will be different every time. I would only like to print the number of rows that have data in them. Please help me with writting a macro to preform this action. Thank you very much. |
All times are GMT +1. The time now is 06:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com