aaaaaaaaaaaaa
aaaaaaaaaaaaa
Last edited by hejszyszki; 05-13-2021 at 09:46 AM.
Check yellow banner at the top of the page. Attach small sample file. It can be also helpful if you place expected result down there.
< LANG pl=ON>Witam na forum< /LANG pl=OFF>
Happy with my answer * Add Reputation.
If You are happy with solution, please use Thread tools and mark thread as SOLVED.
Hi kokosek,
My bad not noticing the rules. There is a sample file.
My idea is that user inputs Parent code & value in sheet PLAN. Then macro is looping through BOM page to find all components of parent material and output it to OutputSheet. Then a simple calculation that im able to do by myself.
Just cant get through decomposing whole parent mat.
Data exported to this file is in sheet BOM & output in sheet Output.
Any ideas?
Thanks in advance!
In you example data in Output, imho, does not matching with BOM data.
B C D 1Parent desc Mat type Component 6Item 1 C 3.1 7Item 1 C 3.2
Sheet: Output
B C D 1Parent Desc Component Comp Desc 10Comp 4 3.1Comp 9 11Comp 4 3.2Comp 10
Sheet: BOM
That is the thing with multi-level BOM. Components might be done also by few other materials thats why it is called as parent in BOM. Thats the trick of extract i have. On the other hand in Output you have Parent-parent item that is made of few components, and those components might be done by another components. So there is fully finished item that is made of Comp 1,2,3,4 and Comp 4 is made of Comp 9 and Comp 10. Comp 10 can be made of Comp 11,Comp 12 etc. Thats why in output there is Item 1 in B column.
Does it make sense?
Thanks in advance!
As I understand that you want to generate requirement for particular components based on req qty of FG.
I know how the BoM works. But I do not get how/why do you want to remove 'levels' of BoM.
Yes, your understanding is very correct![]()
First of all i do not see the way to separate output when user would require more than one item and on the other hand levels are not so necesarry for me and i do not have levels in extract, so i do not know how to associate them automatically since portfolio of products is dynamic. That was my idea, now i see your point as well as an option. Both options seems reasonable tbh ...
Also, one component can be lvl 3 of item 1 and lvl 5 of item 2 no?
Thanks in advance!
Last edited by hejszyszki; 05-08-2021 at 01:48 PM.
Hey kokosek,
Ive been able to achieve multi-level explosion of FG, but no idea how to output also mid-lvl components. Anywhere i edit the code it triggers errors. Also if i try to make the calculation for output in the code it outputs mismatch error, so i left it as quantities for now. The code outputs lowest lvl components and its quanitites. Also how can i make Period inputs recursive? So i do not need to copy paste this code just to refer different cell of input.. Any ideas, help?
thanks in advance!![]()
Sub BomExplosion() Dim ModelCol As Range Dim ModelQntyCol As Range Dim ParentCol As Range Dim Childcol As Range Dim ChildQuantCol As Range Dim ModelOutCol As Range Dim PartCol As Range Dim PartQntCol As Range Dim BaseQty As Range Set ModelCol = Sheets("PLAN").Columns("A") Set ModelQntyCol = Sheets("PLAN").Columns("D") Set ParentCol = Sheets("BOM").Columns("A") Set Childcol = Sheets("BOM").Columns("C") Set ChildQuantCol = Sheets("BOM").Columns("E") Set ModelOutCol = Sheets("Output").Columns("A") Set PartCol = Sheets("Output").Columns("D") Set PartQntCol = Sheets("Output").Columns("F") Const StartDataRow = 2 SummaryRowCount = StartDataRow Lastrow = ParentCol.Cells(Rows.Count, 1).End(xlUp).Row Set ParentRange = ParentCol Set ChildRange = Childcol Set TopLevelPart = ModelCol For RowCount = StartDataRow To Lastrow Child = Childcol.Cells(RowCount, 1) Set c = ParentRange.Find(what:=Child, LookIn:=xlValues, lookat:=xlWhole) If c Is Nothing Then ChildQuant = ChildQuantCol.Cells(RowCount, 1) PartParent = ParentCol.Cells(RowCount, 1) Do Set c = ChildRange.Find(what:=PartParent, LookIn:=xlValues, lookat:=xlWhole) If Not c Is Nothing Then Quant = ChildQuantCol.Cells(c.Row, 1) ChildQuant = ChildQuant * Quant PartParent = ParentCol.Cells(c.Row, 1) End If Loop While Not c Is Nothing Set c = TopLevelPart.Find(what:=PartParent, LookIn:=xlValues, lookat:=xlWhole) If c Is Nothing Then MsgBox ("Cannot find top Level Part : " & PartParent) Else Quant = ModelQntyCol.Cells(c.Row, 1) ChildQuant = ChildQuant * Quant ModelOutCol.Cells(SummaryRowCount, 1) = PartParent PartCol.Cells(SummaryRowCount, 1) = Child PartQntCol.Cells(SummaryRowCount, 1) = ChildQuant SummaryRowCount = SummaryRowCount + 1 End If End If Next RowCount End Sub
Hi,
I managed to solve problem with calculation by adding PerQty column to BOM Sheet and refering to it in code. For now it is just to output mid-lvl components, and eventually add an option for providing multiple periods.
Edited code & example within attached file.
I will be gratefull for any help
Thanks in advance!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks