Insert & Copy Rows If Cell Value Greater Than 1

  • Hello,



    I am in need of a Macro that allows me to insert and copy rows when my Quantity column is greater than 1. I have searched and can find solutions, however I am in a crunch and am not familiar enough with the code and how to make the necessary adjustments for my need.


    I have attached a sample workbook for use, populated with some sample data. I have two worksheets: 1) Showing the data before running a macro, and 2) what I would like the final to look like after running the macro.


    forum.ozgrid.com/index.php?attachment/69649/


    A couple things to note:


    Their are a few ranges that are utilized in the worksheet: B5:Q44, S5:AL44, AO5:BU44, CA5:CA44, CL3:CZ36. There is also one range used purely for lookup, DD3:DR3.


    I am copying and pasting data from our ERP system into only the first range (B5:Q44), with the rest of the ranges populating accordingly for aspects of production that need further information. These ranges are populated via two hidden worksheets that source our SQL Server. These are already setup as needed.


    What I need to accomplish with a macro here is once the data is pasted into the data entry range, I run it and it will find the rows in that range with a value in the column "QTY" greater than 1, and insert and copy that same data to account for the number of that item that is listed (3 rows including the original row for a row with a QTY value of 3).


    If I can get that to work, that is fantastic. In doing so, this may extend the current range size to where it will not print on a single page, however unless the macro can compensate for this I can manually delete rows from the bottom once the macro is ran to accommodate for this.




    Really appreciate anyone/everyone who can lend some help here. Please let me know how I can further clarify anything if it is at all confusing.


    Thanks for the effort!

Participate now!

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