Hi,
I need to duplicate values in a column based on the value of the cell to the right of it, for example if the Quantity column is 1 then no values are duplicated, if the quantity is 2 then the cell to the left (the salary) is copied and pasted at the end of the salary column once, if the quantity is 3 then the salary is copied at the end of the salary column two times. In other words, if the quantity is 1, then the salary should only appear once in the salary column, if the quantity is 2, then the salary should appear twice in the salary column, if the quantity is 3, then the salary should appear for a total of three times in the salary column. Please help, there has to be a way to write VBA for this.
Salary Quantity
15,000 1
20,000 2
27,000 1
30,000 3
41,000 4
After running the macro the final result should be:
Salary Quantity
15,000 1
20,000 2
27,000 1
30,000 3
41,000 4
20,000
30,000
30,000
41,000
41,000
41,000
I need to duplicate values in a column based on the value of the cell to the right of it, for example if the Quantity column is 1 then no values are duplicated, if the quantity is 2 then the cell to the left (the salary) is copied and pasted at the end of the salary column once, if the quantity is 3 then the salary is copied at the end of the salary column two times. In other words, if the quantity is 1, then the salary should only appear once in the salary column, if the quantity is 2, then the salary should appear twice in the salary column, if the quantity is 3, then the salary should appear for a total of three times in the salary column. Please help, there has to be a way to write VBA for this.
Salary Quantity
15,000 1
20,000 2
27,000 1
30,000 3
41,000 4
After running the macro the final result should be:
Salary Quantity
15,000 1
20,000 2
27,000 1
30,000 3
41,000 4
20,000
30,000
30,000
41,000
41,000
41,000