Create a Macro to Print pages which contain content
Hi,
Am Thu, 24 Oct 2013 17:54:42 +0100 schrieb Nerodia:
I am new to writing macros and I need assistance with writing a macro to
select the pages which contain data. I have a monetary input
spreadsheet, which can range from 1 line of data to 500. I would like
to automate the print function to only select the pages which have data
to print.
try:
Sub Test()
Dim LRow As Long
Dim LCol As Long
With Sheets("Sheet1")
LRow = .Cells(.Rows.Count, 1).End(xlUp).Row
LCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
.PageSetup.PrintArea = _
Range(Cells(1, 1), Cells(LRow, LCol)).Address
.PrintOut Copies:=1
End With
End Sub
Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
|