Consulting

Results 1 to 6 of 6

Thread: Produce parts list from breakdown

  1. #1
    VBAX Newbie
    Joined
    Dec 2019
    Posts
    3
    Location

    Produce parts list from breakdown

    Hi I'm very new to vba and need help in making a list populate/calculate from a much larger list containing multiple usages of the same descriptions.

    In the attached file I would like 'Parts Order Form' tab to auto-populate the 'Item Description' and 'QTY' columns from the 'Project Mgmt Final' Tab 'Item Description' and 'Quantity' columns, but also only have one of each description and a total quantity.

    Thank you in advance.
    Attached Files Attached Files

  2. #2
    VBAX Master paulked's Avatar
    Joined
    Apr 2006
    Posts
    1,007
    Location
    Hi and welcome to the forum.

    Not very elegant, but it works!

    Sub Update()
        Dim i As Long, r As Long
        Application.ScreenUpdating = False
        r = 16
        With Sheet2
            For i = 2 To Sheet1.Cells(Rows.Count, 17).End(xlUp).Row
                .Cells(r, 5) = Sheet1.Cells(i, 17)
                .Cells(r, 4) = Sheet1.Cells(i, 19)
                r = r + 1
            Next
            r = 16
            Do Until .Cells(r, 5) = ""
                For i = 16 To .Cells(Rows.Count, 5).End(xlUp).Row
                    If i = r Then GoTo Nxt
                    If .Cells(i, 5) = .Cells(r, 5) Then
                        .Cells(r, 4) = .Cells(r, 4) + .Cells(i, 4)
                        Range(.Cells(i, 5), .Cells(i, 4)).Delete
                    End If
    Nxt:
                Next
                r = r + 1
            Loop
        End With
    End Sub
    Attached Files Attached Files
    Semper in excretia sumus; solum profundum variat.

  3. #3
    VBAX Newbie
    Joined
    Dec 2019
    Posts
    3
    Location
    Thanks very much for doing this. When I run it in my version it gets stuck at End If according to the debugger.

  4. #4
    VBAX Master paulked's Avatar
    Joined
    Apr 2006
    Posts
    1,007
    Location
    With what error? Post your workbook
    Semper in excretia sumus; solum profundum variat.

  5. #5
    VBAX Newbie
    Joined
    Dec 2019
    Posts
    3
    Location
    Not able to upload full workbook as too large even compressed. But have given basic format of it. I'm sure it's a kindie error on my part but I'm very appreciative of your time.
    Attached Files Attached Files

  6. #6
    VBAX Master paulked's Avatar
    Joined
    Apr 2006
    Posts
    1,007
    Location
    I'm not at my PC at the mo, but you need to change sheet1 and sheet2 to match the changed sheet code names and vba can't count #REF!... Put some real numbers in there ��
    Semper in excretia sumus; solum profundum variat.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •