Advanced Filter copy to another sheet (Best Practice)..

Sleeplol

Board Regular
Joined
Apr 10, 2019
Messages
194
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello Everyone,

I'm running AF from Sheet4 ("Dashboard") with data from Sheet3 ("MainDATA")

Currently the filter runs on the Sheet3 then the results are transferred to Sheet4.
In order to do this, however, I am activating Sheet3 then at the end of the code activating Sheet4.

It works, but slows the code by a bit. Is there a more intelligent way of going about this?

VBA Code:
Sub DashAF()

With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

Sheet3.Activate

    Application.CutCopyMode = False
    Application.CutCopyMode = False
  
    Range("MainData[#All]").AdvancedFilter Action:=xlFilterCopy, CriteriaRange _
        :=Range("BC2:BP3"), CopyToRange:=Range("CA2:CM2"), Unique:=False

    Call TransferDashSort 'this transfers the results to the Dashboard on Sheet4
   
Sheet4.Activate

With Application
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With

End Sub
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi,
If you qualify your ranges then the filter should be all that is needed

Untested but try this update to your code & see if does what you want

VBA Code:
Sub DashAF()


  
    Sheet3.Range("MainData[#All]").AdvancedFilter Action:=xlFilterCopy, _
                                                  CriteriaRange:=Sheet3.Range("BC2:BP3"), _
                                                  CopyToRange:=Sheet4.Range("CA2"), _
                                                  Unique:=False

End Sub

Dave
 
Upvote 0

Forum statistics

Threads
1,214,561
Messages
6,120,231
Members
448,951
Latest member
jennlynn

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