View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Javed Javed is offline
external usenet poster
 
Posts: 91
Default Printing Setup help

Hope this will do.................

Sub PrintHDC()

Dim SS As Worksheet
Dim Rng As Range
Dim myDate As String

Set SS = Sheets("HDC")
Set Rng = Application.InputBox(prompt:="Pls select the range",
Default:=SS.UsedRange.Address, Type:=8)

myDate = Format(Date, "Ddd, dd-Mmm-yy")


With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintArea = Rng
.LeftHeader = ""
.CenterHeader = "Page Header Title - " & myDate
.LeftMargin = Application.InchesToPoints(0.33)
.RightMargin = Application.InchesToPoints(0.12)
.TopMargin = Application.InchesToPoints(0.49)
.BottomMargin = Application.InchesToPoints(0.21)
.HeaderMargin = Application.InchesToPoints(0.16)
.FooterMargin = Application.InchesToPoints(0.12)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
End With
ActiveWindow.SelectedSheets.PrintPreview
End Sub