VBA code to add and populate rows in excel

  • I currently have a vba code that performs the function of adding columns but I have had some difficulty with tweaking it to also add and populate rows. This VBA code is in the excel doc that is attached to this post. Please read the request below on what I am looking to achieve

    • I would like a message box to pop up when column E says "Failed" or "Swapped for Upfit" that asks for "How many parts are affected?". Whatever quantity that is put in is automatically subtracted from the Qty (Column D) for that part. After that, a new row with the same info should be added right below with the qty of parts affected. For example, row 8 has "10" in qty (Column D) and I select "failed" in column E. A message box will pop up and I input "2" as the number of parts affected. Then the number of quantity in row 10 column D turns to 8, and two rows are added below. Both will be a copy and paste of row 8 Columns A - C but both will have "2" as quantity (Column D). There are now 3 rows involved, rows 8, 9 and 10. Row 8 will have "On Engine", row 9 will have either "failed" or "Swapped for upfit" based off what was initially selected and row 10 will have "On engine"
    • Once that has been done, for row 9, column F should stop updating. It should stay on that number
    • Row 10, column F should start from where row 9 stopped. For example, the part had 40 hrs before it failed.
    • I would also want an option to hide/show columns at the click of a button. By the click of the button, a message box should pop up asking which of the populated columns I want to hide/show

    This is what I would like the code to do. Please let me know if you have any questions. I also attached a documents that has comments on how the code should work. Hope this explains everything well
    Thank you

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!