+ Reply to Thread
Results 1 to 10 of 10

Grouping project names!!!

Hybrid View

  1. #1
    Registered User
    Join Date
    12-27-2012
    Location
    Chennai
    MS-Off Ver
    Excel 2007
    Posts
    60

    Grouping project names!!!

    Hi,
    I have a excel sheet with two columns.One with username and the other is projects.Each user has more than one projects.I want to make a new list (In a new sheet)with user name and all the projects the particular user is associated with.How can I do this with a help a Macro?
    Thanks...
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Grouping project names!!!

    If a user has more than project linked with, where do the projects appear? which column/s

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Grouping project names!!!

    Try this code
    Option Explicit
    
    Sub create_sheets()
    Dim i As Long, lrow As Long
    Dim sname As String
    
    Application.ScreenUpdating = False
    
    With Worksheets("ProjectResourceReport")
        lrow = .Range("A" & .Rows.Count).End(xlUp).Row
        For i = 2 To lrow
            sname = .Range("A" & i).Value
            If Not Evaluate("ISREF('" & sname & "'!A1)") Then
                Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = sname
                Worksheets(sname).Range("A1").Value = "Projects"
            End If
            Worksheets(sname).Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = .Range("B" & i).Value
        Next i
    End With
    
    MsgBox "Done"
    
    Application.ScreenUpdating = True
    
    End Sub
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose View | Macros
    Select a macro in the list, and click the Run button
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Registered User
    Join Date
    12-27-2012
    Location
    Chennai
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: Grouping project names!!!

    Hi arlu1201,
    Thanks for the reply.
    How can I make all the usernames appear in the same sheet and their projects seperated by comma.
    Username in one column and Projects in another column.

    Thank you.
    Last edited by arlu1201; 04-08-2013 at 05:55 AM. Reason: Do not quote whole posts.

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Grouping project names!!!

    You do not want the output per user in a separate sheet?

  6. #6
    Registered User
    Join Date
    12-27-2012
    Location
    Chennai
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: Grouping project names!!!

    No it has to be actually like this
    A B
    abraham_d iphone,android,common....
    abramson_c iPhone 3.2,Android3.1,Tablet 1.0,iPhone 3.1.1,iPhone 3.0,iPhone 3.3,

  7. #7
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Grouping project names!!!

    Use Pivot Table, refer the attached file for details.

    Place the Cursor In A5 cell and do right Click>>Expand/Collapse>>Try Expand Entire Field Or Collapse Entire Field. Click the Plus Sign individually to see the individual data when the field is in collapsed mode.

    Edit: Oopss I have not pressed F5 to refresh the page. Just worked with excel file based on first post
    Attached Files Attached Files
    Last edited by :) Sixthsense :); 04-08-2013 at 06:03 AM.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Grouping project names!!!

    Sorry, i misunderstood that you want 1 sheet per project.

    Find the updated code
    Option Explicit
    
    Sub group_projects()
    Dim i As Long, lrow As Long
    
    Application.ScreenUpdating = False
    
    Worksheets.Add(after:=Worksheets(1)).Name = "Output"
    Worksheets("ProjectResourceReport").Cells.Copy Worksheets("Output").Range("A1")
    
    With Worksheets("Output")
        lrow = .Range("A" & .Rows.Count).End(xlUp).Row
        .Sort.SortFields.Clear
        .Sort.SortFields.Add Key:=Range("A:A") _
            , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
        With .Sort
            .SetRange Range("A:B")
            .Header = xlYes
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
        
        For i = lrow To 2 Step -1
            If .Range("A" & i).Value = .Range("A" & i - 1).Value Then
                .Range("B" & i - 1).Value = .Range("B" & i - 1).Value & ", " & .Range("B" & i).Value
                .Rows(i).Delete
            End If
        Next i
    End With
    
    MsgBox "Done"
    
    Application.ScreenUpdating = True
    
    End Sub

  9. #9
    Registered User
    Join Date
    12-27-2012
    Location
    Chennai
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: Grouping project names!!!

    Thanks a lot guys!!!

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Grouping project names!!!

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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