I have a single worksheet with 9 sheets. 1st sheet has a list of all users and data matching users. For each day they worked there will be a new row with their name (Max of 6 Rows). So A1-A3 is one name and A4-A10 is another and so on with no constant amount of days worked. Sheet 2 has a list of employees matched to their group. So A1-A5 is Sally Sam Dave Bob and Rick B1-B5 is filled with Lansing. Sheet 3-9 is each group. How would I create a macro that Grabs the Group Name from sheet 2 → Pulls a name → Grabs all data from Sheet 1 that matches the Name → Copy all data relating that name to the appropriate worksheet. And repeat for each name in sheet 2 attached to the group. Then The next group will dido to sheet 4 and so on. I know this is possible but I am new at excel and only know the basic stuff. I am able to find code that copys and pastes and VLookup might work but I am not experienced enough to mash it together.<\/p>","upvoteCount":4,"answerCount":10,"datePublished":"2017-01-31T16:11:46.000Z","author":{"@type":"Person","name":"morganray","url":"https://community.spiceworks.com/u/morganray"},"acceptedAnswer":{"@type":"Answer","text":"
Here is the code that I found to work for me. Thanks everyone for the help!<\/p>\n
Sub parse_data()
\nDim lr As Long
\nDim ws As Worksheet
\nDim vcol, i As Integer
\nDim icol As Long
\nDim myarr As Variant
\nDim title As String
\nDim titlerow As Integer
\nvcol = 1
\nSet ws = Sheets(“All users”)
\nlr = ws.Cells(ws.Rows.Count, vcol).End(xlUp).Row
\ntitle = “A1:G1”
\ntitlerow = ws.Range(“A1:G1”).Cells(1).Row
\nicol = ws.Columns.Count
\nws.Cells(1, icol) = “Unique”
\nFor i = 2 To lr
\nOn Error Resume Next
\nIf ws.Cells(i, vcol) <> “” And Application.WorksheetFunction.Match(ws.Cells(i, vcol), ws.Columns(icol), 0) = 0 Then
\nws.Cells(ws.Rows.Count, icol).End(xlUp).Offset(1) = ws.Cells(i, vcol)
\nEnd If
\nNext
\nmyarr = Application.WorksheetFunction.Transpose(ws.Columns(icol).SpecialCells(xlCellTypeConstants))
\nws.Columns(icol).Clear
\nFor i = 2 To UBound(myarr)
\nws.Range(title).AutoFilter field:=vcol, Criteria1:=myarr(i) & “”
\nIf Not Evaluate(“=ISREF('” & myarr(i) & “'!A1)”) Then
\nSheets.Add(after:=Worksheets(Worksheets.Count)).Name = myarr(i) & “”
\nElse
\nSheets(myarr(i) & “”).Move after:=Worksheets(Worksheets.Count)
\nEnd If
\nws.Range(“A” & titlerow & “:A” & lr).EntireRow.Copy Sheets(myarr(i) & “”).Range(“A1”)
\nSheets(myarr(i) & “”).Columns.AutoFit
\nNext
\nws.AutoFilterMode = False
\nws.Activate
\nEnd Sub<\/p>","upvoteCount":0,"datePublished":"2017-02-01T18:23:00.000Z","url":"https://community.spiceworks.com/t/excel-help/556600/10","author":{"@type":"Person","name":"morganray","url":"https://community.spiceworks.com/u/morganray"}},"suggestedAnswer":[{"@type":"Answer","text":"
I have a single worksheet with 9 sheets. 1st sheet has a list of all users and data matching users. For each day they worked there will be a new row with their name (Max of 6 Rows). So A1-A3 is one name and A4-A10 is another and so on with no constant amount of days worked. Sheet 2 has a list of employees matched to their group. So A1-A5 is Sally Sam Dave Bob and Rick B1-B5 is filled with Lansing. Sheet 3-9 is each group. How would I create a macro that Grabs the Group Name from sheet 2 → Pulls a name → Grabs all data from Sheet 1 that matches the Name → Copy all data relating that name to the appropriate worksheet. And repeat for each name in sheet 2 attached to the group. Then The next group will dido to sheet 4 and so on. I know this is possible but I am new at excel and only know the basic stuff. I am able to find code that copys and pastes and VLookup might work but I am not experienced enough to mash it together.<\/p>","upvoteCount":4,"datePublished":"2017-01-31T16:11:46.000Z","url":"https://community.spiceworks.com/t/excel-help/556600/1","author":{"@type":"Person","name":"morganray","url":"https://community.spiceworks.com/u/morganray"}},{"@type":"Answer","text":"
It would be a lot of help if you could post some examples of what your data looks like currently. Doesn’t have to be your actual data, but just an approximation because I’m kind of having trouble wrapping my head around where things are in your sheets.<\/p>","upvoteCount":2,"datePublished":"2017-01-31T16:16:25.000Z","url":"https://community.spiceworks.com/t/excel-help/556600/2","author":{"@type":"Person","name":"christopheramweg","url":"https://community.spiceworks.com/u/christopheramweg"}},{"@type":"Answer","text":"
agree with Christopher on this one… it definitely sounds easy enough, but I need to see your sample - feel free to use “userX” and “dataX” throughout.<\/p>","upvoteCount":0,"datePublished":"2017-01-31T16:31:08.000Z","url":"https://community.spiceworks.com/t/excel-help/556600/3","author":{"@type":"Person","name":"nic-s","url":"https://community.spiceworks.com/u/nic-s"}},{"@type":"Answer","text":"