Results 1 to 4 of 4

Create new sheets from master sheet based on multiple column criteria

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Create new sheets from master sheet based on multiple column criteria

    Hi,

    I am attempting to modify a macro I have that currently takes a look at a Master sheet, and based on the values it comes across in Col B, it will create new sheets based on those value names.

    For example, Col B contains values such as:
    b
    c
    d
    e
    f
    g

    So new sheets will be created based on the (filtered) criteria above and will be named accordingly as either, b, c, d, e, etc..

    However, I am attempting to take this one step further, and have it create new sheets based on multiple column values.

    For example, it should not only take a look at the values in Col B, but also at the values in Col G which contain conditions such as:
    true
    false


    Here is the macro I am using that creates new sheets (from a master sheet) based on Col B values only:
    Sub Macro2()
         
        Dim rCell As Range, ws As Worksheet
         
        Application.DisplayAlerts = False
         
        With Sheets("Master")
            Sheets.Add().Name = "Temp"
            .Range("B1", .Range("B" & Rows.Count).End(xlUp)).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Sheets("Temp").Range("B1"), Unique:=True
            For Each rCell In Sheets("Temp").Range("B2", Sheets("Temp").Range("B" & Rows.Count).End(xlUp))
                .Range("B1").AutoFilter Field:=2, Criteria1:=rCell
                Set ws = Worksheets.Add(After:=Worksheets(Worksheets.Count))
                ws.Name = rCell
                .AutoFilter.Range.Copy ws.Range("A2")
            Next rCell
            Sheets("Temp").Delete
            .AutoFilterMode = False
        End With
         
        Application.DisplayAlerts = True
         
    End Sub
    My dilemma is that Im not sure how to get this to work with multiple columns (B and G) and create new sheet names accordingly with the filtered values?

    By the way, a thought occurred that if it creates new sheets, it should ideally be named with respect to the combination of the two column values, such as:
    bfalse
    btrue
    cfalse
    ctrue
    dfalse
    dtrue

    etc.

    Thanks in advance for any 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. How to create and populate sheets based upon cell values in master sheet?
    By mezzopiano1423 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2013, 12:51 PM
  2. [SOLVED] Create new sheets based on template from master sheet data/information?
    By jlaurnm in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-13-2012, 08:09 PM
  3. Copy rows from master sheet to other sheets based on criteria
    By spikeysas in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-07-2011, 04:28 AM
  4. Create Multiple Sheets from master sheet
    By neilshaw in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 05-08-2011, 06:10 AM
  5. Create sheets based on a column of master sheet
    By samdaddy07 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-10-2009, 02:54 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