Sub
filter_and_output_results()
Dim
kw1
As
String
Dim
kw2
As
String
Dim
num_gleich
As
Long
kw1 = InputBox(
"Geben Sie die letzte Kalenderwoche ein:"
)
kw2 = InputBox(
"Geben Sie die aktuelle Kalenderwoche ein:"
)
Sheets(
"MASTER_DATEN"
).Range(
"A:C"
).AutoFilter Field:=1, Criteria1:=kw1, VisibleDropDown:=
False
Cells(2, 10).Value = Application.WorksheetFunction.Subtotal(3, Range(
"A:A"
)) - 1
Sheets(
"MASTER_DATEN"
).Range(
"A:C"
).AutoFilter Field:=1, Criteria1:=kw2, VisibleDropDown:=
False
Cells(2, 11).Value = Application.WorksheetFunction.Subtotal(3, Range(
"A:A"
)) - 1
Cells(2, 14).Value = Cells(2, 11).Value - Cells(2, 10).Value
ActiveSheet.Range(
"A:C"
).AutoFilter Field:=1, Criteria1:=kw1
For
i = 1
To
3000
value = Cells(i, 3).Value
If
Application.WorksheetFunction.CountIf(Range(
"A:A"
), kw2) > 1
And
Application.WorksheetFunction.CountIf(Range(
"C:C"
), value) > 1
Then
num_gleich = num_gleich + 1
End
If
Next
i
If
ActiveSheet.AutoFilterMode
Then
ActiveSheet.AutoFilterMode =
False
End
If
Cells(2, 9).Value = num_gleich / 2
Cells(2, 12).Value = Cells(2, 10).Value - Cells(2, 9).Value
Cells(2, 13).Value = Cells(2, 11).Value - Cells(2, 9).Value
End
Sub