Probiere es mal...
19.09.2016 08:48:03
Case
Hallo, :-)
... so: ;-)
Option Explicit
Private Sub CommandButton1_Click()
Dim lngLastRow As Long
Dim lngCalc As Long
On Error GoTo Fin
With Application
.ScreenUpdating = False
.AskToUpdateLinks = False
.EnableEvents = False
lngCalc = .Calculation
.Calculation = xlCalculationManual
.DisplayAlerts = False
End With
With ThisWorkbook.Worksheets("ToDoListe")
lngLastRow = IIf(Len(.Cells(.Rows.Count, 1)), _
.Rows.Count, .Cells(.Rows.Count, 1).End(xlUp).Row)
.Sort.SortFields.Clear
.Sort.SortFields.Add Key:=Range("B4:B" & lngLastRow), SortOn:=xlSortOnValues, Order:= _
xlAscending, DataOption:=xlSortNormal
With .Sort
.SetRange Range("B3:K" & lngLastRow)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
With Application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = lngCalc
.DisplayAlerts = True
End With
On Error Resume Next
.Cells(Application.Match(CDbl(Date), .Columns(2), 0), 2).Select
If Err.Number = 13 Then .Cells(.Rows.Count, 2).End(xlUp).Select
On Error GoTo Fin
End With
Fin:
If Err.Number 0 Then MsgBox "Error: " & _
Err.Number & " " & Err.Description
End Sub
Servus
Case