Home |
Search |
Today's Posts |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
printing setup issue in 2007 | Excel Discussion (Misc queries) | |||
Printing - Setup | Setting up and Configuration of Excel | |||
Page Setup Printing | Excel Discussion (Misc queries) | |||
can VBA be used to set page setup for printing? | Excel Discussion (Misc queries) | |||
setup for userform printing | Excel Programming |