AW: Zeilen ausblenden nach einem oder mehreren Kreteri
21.11.2009 19:00:04
Josef
Hallo Joachim,
ist sicher noch Ausbaubar.
Sub Zeilen_ausblenden()
Dim lngRow As Long, lngLast As Long
Dim lngDate As Long, strFind As String
Dim rngHide As Range
lngDate = Application.InputBox("Geben Sie das Datum ein", "Datum", CStr(Date), Type:=1)
If lngDate = 0 Or Not IsDate(CDate(lngDate)) Then
MsgBox "Abbruch!" & vbLf & "Ungültiges Datum!", vbExclamation, "Fehler"
Exit Sub
End If
strFind = InputBox("Geben Sie den Suchbegriff ein", "Suchbegriff", "Auswertung")
If strFind = "" Then
MsgBox "Abbruch!" & vbLf & "Ungültiger Suchbegriff", vbExclamation, "Fehler"
Exit Sub
End If
With Sheets("EG aktuell")
lngLast = Application.Max(3, .Cells(.Rows.Count, 4).End(xlUp).Row)
.Rows.Hidden = False
For lngRow = 3 To lngLast
If .Cells(lngRow, 4).Value < lngDate Then
If Application.CountIf(.Range(.Cells(lngRow, 1), .Cells(lngRow, 4)), strFind) = 0 Then
If rngHide Is Nothing Then
Set rngHide = .Rows(lngRow)
Else
Set rngHide = Union(rngHide, .Rows(lngRow))
End If
End If
End If
Next
End With
If Not rngHide Is Nothing Then rngHide.EntireRow.Hidden = True
Set rngHide = Nothing
End Sub
Gruß Sepp