View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.newusers
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Create a Macro to Print pages which contain content

Hi again,

Am Thu, 24 Oct 2013 20:22:59 +0200 schrieb Claus Busch:

better 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
If LRow 1 And LCol 1 Then
.PageSetup.PrintArea = _
Range(Cells(1, 1), Cells(LRow, LCol)).Address
.PrintOut Copies:=1
End If
End With
End Sub


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2