Results 1 to 2 of 2

Code to filter and copy paste data

Threaded View

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

    Code to filter and copy paste data

    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(d2:d10000,,,row(1:10000)),d2:d1000)=1,d2:d1000,char(2)))], Chr(2), 0)
    .AutoFilter 4, e
    .Copy Sheets("sheet2").Cells(1)
    Sheets("sheet2").Copy
    ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & e & ".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. VBA Code to filter,Copy and Paste data from one sheet to the other
    By aravindkm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-18-2013, 03:39 PM
  2. VB code to filter copy and paste in a different sheet
    By rshnkmr39 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-26-2013, 12:53 AM
  3. Copy paste data after filter
    By Abhijit2011 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-05-2011, 06:10 AM
  4. Data Filter copy Paste
    By pr4t3ek in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-09-2011, 12:54 AM
  5. need code for copy/paste, highlighting columns and enabling auto-filter/freeze panes
    By excelaspire0219 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2009, 05:45 PM

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