Results 1 to 6 of 6

Splitting data based on column value

Threaded View

  1. #1
    Registered User
    Join Date
    09-26-2017
    Location
    Michigan
    MS-Off Ver
    2013
    Posts
    3

    Splitting data based on column value

    Good morning,

    I work for a manufacturing company, and I've been trying to create a new spreadsheet that will split data of Non-conforming material based on a supplier number into a new sheet. I would also like each new sheet to be in the form of a table. My goal would be to link each table to one slicer that sorts data based on week ending dates. From there, I can email each supplier their own list of non-conforming material for the week.

    I realize that I can accomplish some of this by "Show report filter pages..." pivot table function, but the problem is, this database is refreshed daily, and when a new supplier that hasn't been in our database before shows up, the pivot tables have already been created and there won't be a new page with a new pivot table for the new supplier (My data source for the pivot tables goes the entire length of the columns).

    I have also tried parsing data using the code below, but I find that it only runs effectively one time initially. So if I try to run the macro again, it won't split new data. Also, this code below doesn't do anything with formatting the data/keeping data in table form.

    Sub parse_data()
    Dim lr As Long
    Dim ws As Worksheet
    Dim vcol, i As Integer
    Dim icol As Long
    Dim myarr As Variant
    Dim title As String
    Dim titlerow As Integer
    vcol = 14
    Set ws = Sheets("NON-CON_PARTS")
    lr = ws.Cells(ws.Rows.Count, vcol).End(xlUp).Row
    title = "A1:S1"
    titlerow = ws.Range(title).Cells(1).Row
    icol = ws.Columns.Count
    ws.Cells(1, icol) = "Unique"
    For i = 2 To lr
    On Error Resume Next
    If ws.Cells(i, vcol) <> "" And Application.WorksheetFunction.Match(ws.Cells(i, vcol), ws.Columns(icol), 0) = 0 Then
    ws.Cells(ws.Rows.Count, icol).End(xlUp).Offset(1) = ws.Cells(i, vcol)
    End If
    Next
    myarr = Application.WorksheetFunction.Transpose(ws.Columns(icol).SpecialCells(xlCellTypeConstants))
    ws.Columns(icol).Clear
    For i = 2 To UBound(myarr)
    ws.Range(title).AutoFilter field:=vcol, Criteria1:=myarr(i) & ""
    If Not Evaluate("=ISREF('" & myarr(i) & "'!A1)") Then
    Sheets.Add(after:=Worksheets(Worksheets.Count)).Name = myarr(i) & ""
    Else
    Sheets(myarr(i) & "").Move after:=Worksheets(Worksheets.Count)
    End If
    ws.Range("A" & titlerow & ":A" & lr).EntireRow.Copy Sheets(myarr(i) & "").Range("A1")
    Sheets(myarr(i) & "").Columns.AutoFit
    Next
    ws.AutoFilterMode = False
    ws.Activate
    End Sub
    My columns range from A-S, my columns with the supplier number I want data split by is in column N (VCOL = 14), and my week ending dates are in column Q (VCOL = 17)

    I'm fairly inexperienced with VBA, but I've been resourceful in accomplishing smaller tasks. I'm a bit out of my depth on this apparently.

    Thanks for help!
    Last edited by Ndekk; 09-26-2017 at 12:05 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Splitting raw data into two new worksheets based on single column
    By Ezzard in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-03-2016, 08:21 PM
  2. Splitting out Excel data to multiple files based on one column's values
    By MetroBOS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-04-2015, 11:38 AM
  3. [SOLVED] splitting data into multiple tabs based on column criteria
    By bardobhb in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-02-2014, 02:30 PM
  4. [SOLVED] splitting data into multiple tabs based on column criteria
    By bardobhb in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-26-2014, 11:57 PM
  5. [SOLVED] Splitting up data into separate sheets based on a column
    By cloakedgerb in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-23-2014, 12:37 PM
  6. Splitting data into seperate spreadsheets based on column values
    By narendrabr in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 02-03-2014, 07:16 AM
  7. [SOLVED] Splitting worksheets based on a column Data
    By Deventus in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-17-2012, 06:40 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