Auto Filter
14.04.2007 15:32:49
Andreas
Hallo Excelprofis!
Mit nachfolgendem Code (Danke an Franz) blende ich bestimmte Zeilen und Spalten per Autofilter aus, drucke das Ganze und blende alles wieder ein.
Jetzt brauche ich aber auch eine Möglichkeit, alle Zeilen zu drucken bei denen in AC, und/oder AD, und/oder AE, und/oder AF eine 1 steht. Wie muß ich das machen? Habe schon etwas probiert, bin aber nicht weitergekommen.
Danke für die Hilfe und Mühe!
mfg Andreas
Private Sub CommandButtonDruck1_Click()
Dim lZeile As Long
'zur Auswertung wechseln
Sheets("Auswertung").Select
With Sheets("Auswertung")
.Unprotect "xyz"
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
'per Autofilter Zeilen ausblenden
.Range("AC7:AC65536").AutoFilter Field:=1, Criteria1:="<>", Operator:=xlAnd
Application.Calculation = xlCalculationAutomatic
'Sortieren nach Firma
.Range("A8:AF1500").Sort Key1:=Range("B8"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
'Spalten ausblenden
.Range("A:A,C:C,E:E,F:F,G:G,H:H,I:I,L:AF").EntireColumn.Hidden = True
With .PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
.PageSetup.PrintArea = ""
With .PageSetup
.LeftMargin = Application.InchesToPoints(0.78740157480315)
.RightMargin = Application.InchesToPoints(0.78740157480315)
.TopMargin = Application.InchesToPoints(0.78740157480315)
.BottomMargin = Application.InchesToPoints(0.590551181102362)
.HeaderMargin = Application.InchesToPoints(0)
.FooterMargin = Application.InchesToPoints(0)
.PrintHeadings = False
.PrintGridlines = True
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 999
End With
Application.ScreenUpdating = True
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Selection.AutoFilter 'Autofilter wieder abschalten
.Columns.EntireColumn.Hidden = False
'nach Nummern sortieren
.Range("A8:AF1500").Sort Key1:=Range("A8"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
.Protect "xyz"
.Range("B1").Select
End With
End Sub