Generate New Tabs Based off of Data in a Column

leocomerlato

New Member
Joined
Jun 8, 2015
Messages
8
My knowledge of Microsoft Excel is limited. One of the things I have to do on a daily basis is a data pull. I then filter the data by the date column. I create a new tab for every date and post the corresponding data for that date in the tab.

Is there anyway to automate this?

Microsoft Excel 2010
Windows 7 SP1 64Bit
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Anything you can do manually you can automate.
Describe what the data looks like, what you filter it on (and in which columns), etc.
 
Upvote 0
Anything you can do manually you can automate.
Describe what the data looks like, what you filter it on (and in which columns), etc.


The below is just an example I whipped up. I'd want to be able to base it off the Received Date column. The way I name the tabs is May 8, October 3, etc.
OWNER_TEAM_NAMERECEIVED_DATESTATUS_CDCCP_INQ_KEYCONTACT_IDINQUIRY_ID
TEAM - A08-May-15OP000000000000000000000000000000000000000001
TEAM - A03-Oct-14OP000000000000000000000000000000000000000001
TEAM - A18-May-15OP000000000000000000000000000000000000000001
TEAM - A27-Jan-15OP000000000000000000000000000000000000000002
TEAM - A14-May-15OP000000000000000000000000000000000000000001

<tbody>
</tbody><colgroup><col><col><col><col><col><col></colgroup>
 
Upvote 0
Try:
Code:
Sub CopyData()
    Application.ScreenUpdating = False
    Dim bottomB As Integer
    bottomB = Range("B" & Rows.Count).End(xlUp).Row
    Dim c As Range
    Dim rng As Range
    Dim ws As Worksheet
    ActiveSheet.Sort.SortFields.Clear
    ActiveSheet.Sort.SortFields.Add Key:=Range("B2:B" & bottomB), _
        SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveSheet.Sort
        .SetRange Range("A1:F" & bottomB)
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    For Each c In Range("B2:B" & bottomB)
        Set ws = Nothing
        On Error Resume Next
        Set ws = Worksheets(Format(c, "dd-MMM-yy"))
        On Error GoTo 0
        If ws Is Nothing Then
                Worksheets.Add(After:=Sheets(Sheets.Count)).Name = Format(c, "dd-MMM-yy")
        End If
    Next c
    For Each rng In Sheets("Sheet1").Range("B2:B" & bottomB)
        For Each ws In Sheets
            If Format(rng, "dd-MMM-yy") = ws.Name Then
                rng.EntireRow.Copy Sheets(ws.Name).Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
            End If
        Next ws
    Next rng
    Application.ScreenUpdating = True
 End Sub
 
Upvote 0
You'll have to excuse me. I've never used code so I tried googling it and finding a way to do it, but I think I may be doing it incorrectly as I'm getting an error. How would you suggest I go about implementing this?
 
Upvote 0
Do the following: Hold down the ALT key and press the F11 key. This will open the Visual Basic Editor. In the menu at the top click 'Insert' and then click 'Module'. Copy and paste the macro into the empty code window that opens up. Press the F5 key to run the macro. Close the code module window to return to your sheet. There are other quicker ways to run the macro such as assigning it to a button that you would click on your sheet or assigning it to a short cut key.
 
Upvote 0
Do the following: Hold down the ALT key and press the F11 key. This will open the Visual Basic Editor. In the menu at the top click 'Insert' and then click 'Module'. Copy and paste the macro into the empty code window that opens up. Press the F5 key to run the macro. Close the code module window to return to your sheet. There are other quicker ways to run the macro such as assigning it to a button that you would click on your sheet or assigning it to a short cut key.

That works! You're the best! Is there a way for it to import the First Row Headers too?
 
Upvote 0
Place this line:
Code:
Sheets("Sheet1").Rows(1).Copy ActiveSheet.Cells(1, 1)
below this line:
Code:
Worksheets.Add(After:=Sheets(Sheets.Count)).Name = Format(c, "dd-MMM-yy")
 
Upvote 0

Forum statistics

Threads
1,203,203
Messages
6,054,099
Members
444,702
Latest member
patrickmg17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top