View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Vacuum Sealed[_2_] Vacuum Sealed[_2_] is offline
external usenet poster
 
Posts: 87
Default Printing Setup help

Garry & All

As promised here is the final working very well code:

Sub PrintHDC()

Dim theDay As String
Dim theDate As String
Dim myDate As String

theDay = Format(Date, "Ddd")

If theDay = "Mon" Then
theDate = Date - 3
Else
theDate = Date - 1
End If

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

Columns("L:L").Select
Selection.ColumnWidth = 30

Cells.Select
With Selection
.WrapText = True
End With
Rows("2:200").Select
Selection.Rows.AutoFit

Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select

Selection.Sort Key1:=Range("D2"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

With ActiveSheet.PageSetup
.PrintArea = Selection.Address
.PrintTitleRows = "$1:$1"
.CenterHeader = "HDC - " & myDate
.FitToPagesWide = 1
End With

Application.ActivePrinter = "\\SPRN01\WOW HDC on Ne01:"
ActiveWindow.SelectedSheets.PrintPreview

End Sub

Cheers