Hi,
I´m trying to filter out unique names based on chosen year and organizational unit from a list that contains approx 20000 rows.
Use code below, which is executed with a control button. I experience performance issues, the macro takes 5-10 sec to run.
Is there any better way to do it?
I´m trying to filter out unique names based on chosen year and organizational unit from a list that contains approx 20000 rows.
Use code below, which is executed with a control button. I experience performance issues, the macro takes 5-10 sec to run.
Is there any better way to do it?
Code:
Sub filter()
Application.ScreenUpdating = False
Sheets("Resurstid").Visible = True
Sheets("Resurstid").Select
Columns("A:F").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"H1:M2"), CopyToRange:=Range("H4"), Unique:=True
Sheets("Analys per konsult").Select
With Sheets("Analys per konsult")
With .Range("B15:N1000")
.Clear
End With
Dim lastRow2 As Long
lastRow2 = Sheets("Resurstid").Range("H" & Rows.Count).End(xlUp).Row + 7
Sheets("Analys per konsult").Range("B13:N13").AutoFill Destination:=Sheets("Analys per konsult").Range("B13:N" & lastRow2)
End With
Sheets("Resurstid").Visible = False
End Sub