Performance issue VB

Alex B

New Member
Joined
Jan 22, 2015
Messages
12
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?

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
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Welcome to MrExcel.

Have you tried setting Calculation to Manual at the beginning and Automatic at the end?
 
Upvote 0
What are your filter criteria and what do you have in B13:N13 on worksheet "Analys per konsult"?

The list from which I try to filter unique resource names looks like this

ResourceAssignmentYearPeriodOrg.unitHours
Agneta FribergExterna Uppdrag20131842291,5
Agneta FribergExterna Uppdrag20132842299,5
Agneta FribergExterna Uppdrag20133842283,5
Agneta FribergExterna Uppdrag201348422139,5
Alex AugustssonExterna Uppdrag201328411160
Alex AugustssonExterna Uppdrag201338411160

<tbody>
</tbody>


The advanced filter setup is

AssignmentYearPeriodOrg.unitHours
20148411*

<tbody>
</tbody>

Where org.unit is chosen in a drop down.


In B13:N13 on worksheet "Analys per konsult", I have formulas that summarize revenue, gross profit, chargeability
from the first table above and another table. Formulas are SUMIFS, where the filtered names are one of the conditions.
 
Upvote 0
Is this any quicker?

Code:
Sheets("Analys per konsult").Range("B13:N13").Copy Sheets("Analys per konsult").Range("B14:N" & lastRow2)
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,276
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top