AW: VBA Drucken bestimmter bereich
13.10.2016 08:36:01
KlausF
Hallo Addi,
könnte so klappen:
Sub Drucken()
Dim lastCell As Range
Dim intCol As Integer
Dim lngLast As Long
Set lastCell = ActiveSheet.Cells.Find(What:="*", After:=ActiveSheet.Range("A7"), _
LookIn:=xlFormulas, lookat:=xlWhole, searchorder:=xlByRows, searchdirection:=xlPrevious)
intCol = lastCell.Column
lngLast = lastCell.Row
Dim rngPrint As Range
Set rngPrint = ActiveSheet.Range("A7", Cells(lngLast, intCol))
ActiveSheet.PageSetup.PrintArea = rngPrint.Address
With ActiveSheet.PageSetup
'.Orientation = xlLandscape 'Querformat
.Orientation = xlPortrait 'Hochformat
'___________________________
'Druck auf eine Seite:
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.CenterHorizontally = True
.CenterVertically = False
End With
ActiveSheet.PrintPreview
'oder
'ActiveSheet.PrintOut From:=1, To:=1, Copies:=1
ActiveSheet.DisplayAutomaticPageBreaks = False
Set lastCell = Nothing
Set rngPrint = Nothing
End Sub
Gruß
Klaus