Results 1 to 5 of 5

Filtering and copy pasting to new sheet

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-13-2009
    Location
    Manila philippines
    MS-Off Ver
    Excel 2010
    Posts
    113

    Filtering and copy pasting to new sheet

    Hi,

    I am currently have a code that filters and copy pasting to a new sheet. However, I do not want to copy the last column (filtered value) for all the new sheets. Is this possible?

     Sub filter()
    Application.ScreenUpdating = False
    Dim x As Range
    Dim rng As Range
    Dim last As Long
    Dim sht As String
    
    'specify sheet name in which the data is stored
    sht = "Sheet1"
    
    'change filter column in the following code
    last = Sheets(sht).Cells(Rows.Count, "F").End(xlUp).Row
    Set rng = Sheets(sht).Range("A1:F" & last)
    
    Sheets(sht).Range("F1:F" & last).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("AA1"), Unique:=True
    
    For Each x In Range([AA2], Cells(Rows.Count, "AA").End(xlUp))
    With rng
    .AutoFilter
    .AutoFilter Field:=6, Criteria1:=x.Value
    .SpecialCells(xlCellTypeVisible).Copy
    
    Sheets.Add(After:=Sheets(Sheets.Count)).Name = x.Value
    ActiveSheet.Paste
    End With
    Next x
    
    ' Turn off filter
    Sheets(sht).AutoFilterMode = False
    
    With Application
    .CutCopyMode = False
    .ScreenUpdating = True
    End With
    
    End Sub
    Attached Files Attached Files
    Last edited by bambino86; 09-07-2017 at 02:24 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Filtering by cell value then pasting matching Values to one Summary sheet
    By CUoper in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-07-2017, 12:56 PM
  2. Replies: 5
    Last Post: 02-19-2016, 06:17 PM
  3. Excel 2007 - VBA to copy data from one sheet and pasting to another sheet
    By abhimails in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-29-2014, 07:40 AM
  4. filtering multiple columns and pasting the rows on a new sheet
    By kalelclark in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-30-2014, 03:04 AM
  5. Simply Copy and pasting data from one sheet to another sheet but certain cells....
    By cory0789 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-24-2014, 09:36 AM
  6. Macro for filtering raw data,copy/ pasting and sorting based on conditions
    By amazingjeffery in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-17-2013, 02:45 AM
  7. Problem when copy pasting a picture from sheet to sheet
    By leugu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-15-2011, 04:07 AM

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