Macro VBA help - Copy and Paste rows in a table based on a value in a different cell

Copper Contributor

I am look for Macro VBA assistance. I am created an auto-populating inventory Excel workbook. I'm stuck on my current step: automatically adding rows to a table. I created an ActiveX command button that I hope will take a numerical value entered in a cell on that same sheet and copy/paste row 1 of a table on another sheet. The first row of that table has formulas that pull data from another sheet, so I don't want to just insert rows. To summarize what I hope happens:

 

1. Enter number in cell (Sheet2:D20) - value "X"

2. Click command  button = (Sheet1:Table:Row1) - not header row - (Sheet1:A3:K3) is copied and pasted, starting in position (Table:Row2), "X" minus 1, as part of that table.

 

Row1 is part of the inventory, so minus 1 is optional until I get this figured out... but it would be nice to have.

 

I am also open to other suggestions for other options to accomplish the solution (enter a number, click a button, and the complete table on Sheet1 is created). I have searched a lot, but I haven't found VBA scripting for exactly what I am looking for.

 

Thanks!

0 Replies