Results 1 to 1 of 1

Macro to filter and copy to new excel

Threaded View

  1. #1
    Forum Contributor
    Join Date
    06-05-2014
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    155

    Macro to filter and copy to new excel

    Hi Team,

    I am using the below code to automatically filter the data and copy the filtered data to new excel.
    I got this code from the same forum.

    Sub test()
    Dim e
    Application.ScreenUpdating = False
    With Sheets("sheet1").Cells(1).CurrentRegion
    .Parent.AutoFilterMode = False
    For Each e In Filter(.Parent.[transpose(if(countif(offset(a2:a10000,,,row(1:10000)),a2:a1000)=1,a2:a1000&char(3)&e2:e10000,char(2)))], Chr(2), 0)
    .AutoFilter 1, Split(e, Chr(3))(0)
    .Copy Sheets("sheet2").Cells(1)
    Sheets("sheet2").Copy
    ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & Split(e, Chr(3))(1) & ".xlsx"
    ActiveWorkbook.Close
    .AutoFilter: Sheets("sheet2").Cells.Clear
    Next
    End With
    Application.ScreenUpdating = False
    End Sub

    The problem that I am facing now is my source data got changed in such a way that the filter has to be applied in row 3, column 4 instead of row 1.

    I tried editing but I am getting errors. I request someone to help me. Sample data with the previous code attached. Column G,H,I are newly added in this sheet.

    Please help
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Macro to filter and copy to new excel
    By arun.sj in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-19-2015, 08:53 AM
  2. [SOLVED] excel macro Filter all sheets with same criteria and copy results to new sheet
    By cpramesh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-11-2014, 07:13 AM
  3. [SOLVED] Excel 2007-Adv Filter Copy and Loop with Nested Autofilter Using Values from Adv Filter
    By Southfish in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-17-2014, 02:07 AM
  4. Replies: 2
    Last Post: 01-26-2013, 04:26 AM
  5. Need macro to filter, create tab on filter and copy/paste
    By Jen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-02-2006, 11:50 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1