Situation: An initial order is placed with a vendor. Quantity, Standard Delivery Date. and Order Date are recorded for each line item (Initial Order Tab). The vendor takes the order and they say, "nope, you can't have it then, but here is what you can have." And respond with their First Confirmations. They will give a quantity and date for when they are agreeing to deliver the items (First Confirmation tab). With global supply issues our vendors are sometimes unable to meet their original commitments. Sales chases down the missing items and gets New Confirmations from the vendor (New Confirmation tab).
Problem: I need to link the new confirmations to first confirmations to initial orders to get so I can evaluate how our supply chain is performing based on systemic dates as compared to vendors first confirmed dates, etc. I have included an example of one order and the information associated with that order. The solution is going to be used to analyze ~150 orders at a time (so lots of lines).
Initial thoughts: My plan was to concatenate the Purchase Document, Line Item, and Schedule as a number. Then duplicate the rows with VBA. The concatenated number could then also be used as a serial count and/or use a series of pivot tables to get all of the lines/dates traced backwards.
Formula for concatenation (=IF($A2="","",(A2&"00000")+0+((B2&"00")+0)+(F2+0))
VBA for Row Duplication
'Duplicate rows based on column quantity
Sub DupeRows()
'Declare Variables
Dim cell As Range
'Set initial cell - condition to duplicate
Set cell = Range("e2")
'Formula - Do While Not - If/Then - Loop
Do While Not IsEmpty(cell)
Set cell = cell.Offset(cell.Value, 0)
If cell > 1 Then
Range(cell.Offset(1, 0), cell.Offset(cell.Value - 1, 0)).EntireRow.Insert
Range(cell, cell.Offset(cell.Value - 1, 1)).EntireRow.FillDown
End If
Set cell = cell.Offset(cell.Value, 0)
Loop
End Sub
Conclusion: This is a brute force approach and I know that their must be a more elegant solution. Please help![]()
Bookmarks