Help with VBA macro

  • Hello all,

    I'm trying to create one macro for my data but without good results.

    I would be grateful if someone helps me out with this.


    Please find attached the spreadsheet that I would need help for.


    Case:

    I receive data from my system in Sheet1.

    In Sheet1, in cell A5 I have part number 546360 with his qty, price, and name (B5, C5, D5, E5).

    That part number (546360) is my main product, but it has its components (all the list with components are in sheet Components).


    I would need to create a macro which will go over Sheet1 - Column A, and if find a part number that is in sheet Components - Column A, the macro will insert (in Sheet1) rows and copy/paste all those components (with prices and Item Description) below the line that has found the match.


    Also, Order ID needs to be copied below in all newlines with components.


    The final result (I manual created as a sample) is in the sheet "Final sheet".


    Thanks in advance.


    Nikola

  • Not sure if this is exactly what you want but it's my best shot.


    Might seem a bit of a weird solution but I find that with large spreadsheets inserting rows can be a bit slow so tried to cut that bit out.

  • Hello trunten,

    thank you werry much for your support on this.

    I missed one more step that I need to create. When macro add a new line, can macro delete the main product line (only component needs to be in the final sheet)?

    One more time...thanks a lot.

    Regards,

    Nikola