Consulting

Results 1 to 3 of 3

Thread: Copy filtered data in new sheet and name it after criteria

  1. #1

    Exclamation Copy filtered data in new sheet and name it after criteria

    Hello every One
    I'm trying to make a code that will copy in a new sheet all the values filtered, and name the new sheet after all criteria used in filter
    Here i attached my file.
    the code can find the first criteria but not the second

    Thanks for all help

  2. #2
    I do not know what filter you have used. use "advance filter". see help under this.

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Call the second sub from the first, passing the new sheet name.
    [VBA]Sub Filter()
    '........................
    Filter_Create Crit1 & " " & crit2
    End Sub

    Sub Filter_Create(ShName)
    '..........................
    ' Add a new worksheet to copy the filter results in.
    Set WSNew = Worksheets.Add
    WSNew.Name = ShName
    '..........................
    End Sub
    [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

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