Results 1 to 4 of 4

Split data into separate worksheets and sort

Threaded View

  1. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Split data into separate worksheets and sort

    Quote Originally Posted by jxm1092 View Post
    and the data on each individual worksheet can be put in order by time that would be great. Also were would be a great place to get some insight on how to write these types of macros myself?

    Thanks eveyrone.
    Sub test()
        Dim x, e
        Application.ScreenUpdating = False
        With Sheets("R1_1375_test").Cells(1).CurrentRegion
            .Sort key1:=.Cells(1, 3), order1:=1, key2:=.Cells(1, 2), order2:=1, Header:=xlYes
            With .Offset(1).Resize(.Rows.Count - 1).Columns("c")
                x = Filter(.Parent.Evaluate("transpose(if(countif(offset(" & _
                .Address & ",0,0,row(1:" & .Rows.Count & "))," & .Address & _
                ")=1," & .Address & ",char(2)))"), Chr(2), False)
            End With
            For Each e In x
                If Not IsSheetExists(e) Then Sheets.Add(after:=Sheets(Sheets.Count)).Name = e
                Sheets(e).Cells.Clear
                .AutoFilter 3, e
                .Copy Sheets(e).Cells(1)
                With Sheets(e).Cells(1).CurrentRegion
                    .Sort .Cells(1, 2), 1, Header:=xlYes
                    .Columns.AutoFit
                End With
                .AutoFilter
            Next
            .Sort .Cells(1), 1, Header:=xlYes
            .Parent.Activate
        End With
        Application.ScreenUpdating = True
    End Sub
    
    Function IsSheetExists(ByVal txt As String) As Boolean
        On Error Resume Next
        IsSheetExists = Len(Sheets(txt).Name)
        On Error GoTo 0
    End Function
    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. [SOLVED] Split worksheets to separate files
    By ksteffin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-10-2013, 06:04 AM
  2. Replies: 1
    Last Post: 03-29-2013, 03:06 PM
  3. Split data by Criteria into separate worksheets on one workbook
    By TrebleC in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-05-2013, 08:39 AM
  4. Split into Separate Worksheets
    By bigroo1958 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-15-2010, 10:54 AM
  5. Split my data into separate worksheets
    By drunk8gods in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-12-2010, 04:20 PM

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