Skip to main content

How to copy data to another worksheet with Advanced Filter in Excel?

Author: Xiaoyang Last Modified: 2024-12-09

The Advanced Filter feature in Excel allows you to extract and filter data from a dataset. While it works seamlessly within the same worksheet, you may encounter a warning message when attempting to copy the filtered results to another worksheet. In this guide, we will show you step-by-step how to copy filtered data to another worksheet using both the Advanced Filter feature and VBA code.

A screenshot showing a warning message when using Advanced Filter to copy data to another worksheet in Excel

Copy data to another worksheet with Advanced Filter by using Advanced Filter feature

Copy data to another worksheet with Advanced Filter by using VBA code


Copy data to another worksheet with Advanced Filter by using Advanced Filter feature

Here is a simple workaround for you to solve this job, please do as this:

1. Activate the worksheet where you want to copy the filtered result by using the Advanced Filter function.

A screenshot showing the worksheet activated for copying filtered results using Advanced Filter in Excel

2. Then click Data > Advanced, see screenshot:

A screenshot highlighting the Advanced option under the Data tab in Excel

3. In the Advanced Filter dialog box, select Copy to another location from the Action section, and then click Range selection button button to select the data range which you want to filter in another sheet beside the List range, go on clicking Range selection button button beside the Criteria range to select the criteria from another sheet, see screenshot:

A screenshot of the Advanced Filter dialog box in Excel with List Range and Criteria Range selected

4. Then click Range selection button button beside the Copy to box to select a cell where you want to output the filtered result from the active sheet, and then click OK button, the filtered result has been extracted into another sheet based on your original data sheet.

A screenshot showing the filtered results copied to another worksheet using Advanced Filter in Excel


Copy data to another worksheet with Advanced Filter by using VBA code

If you are skilled with VBA, you can complete this task using the following VBA code.

1. Activate the worksheet which you want to filter and copy the result to another sheet.

2. Hold down the ALT + F11 keys in Excel, and it opens the Microsoft Visual Basic for Applications window.

3. Click Insert > Module, and paste the following code in the Module Window.

VBA code: Copy data to another worksheet with Advanced Filter:

Sub Advancedfiltertoanothersheet()
'Updateby Extendoffice
    Dim xStr As String
    Dim xAddress As String
    Dim xRg As Range
    Dim xCRg As Range
    Dim xSRg As Range
    On Error Resume Next
    xAddress = ActiveWindow.RangeSelection.Address
    Set xRg = Application.InputBox("Please select the filter range:", "Kutools for Excel", xAddress, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    Set xCRg = Application.InputBox("Please select the criteria range:", "Kutools for Excel", "", , , , , 8)
    If xCRg Is Nothing Then Exit Sub
    Set xSRg = Application.InputBox("Please select the output range:", "Kutools for Excel", "", , , , , 8)
    If xSRg Is Nothing Then Exit Sub
    xRg.AdvancedFilter xlFilterCopy, xCRg, xSRg, False
    xSRg.Worksheet.Activate
    xSRg.Worksheet.Columns.AutoFit
End Sub

4. And then press F5 key to run this code, and a prompt box is popped out to let you select the data range that you want to filter, see screenshot:

A screenshot of a prompt box for selecting the filter range when using VBA to copy filtered data in Excel

5. Click OK, and another dialog box will appear, prompting you to select the criteria range for filtering, as shown in the screenshot:

A screenshot of a prompt box for selecting the criteria range when using VBA to copy filtered data in Excel

6. Go on clicking OK, in the popped out dialog box, please select a cell from another new worksheet where you want to output the filter result, see screenshot:

A screenshot of a prompt box for selecting the output range in another worksheet using VBA to copy filtered data in Excel

7. At last, click OK button, the filtered data has been outputted into another specified sheet as you need.

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!