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

%3CLINGO-SUB%20id%3D%22lingo-sub-1766219%22%20slang%3D%22en-US%22%3EMacro%20VBA%20help%20-%20Copy%20and%20Paste%20rows%20in%20a%20table%20based%20on%20a%20value%20in%20a%20different%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1766219%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20look%20for%20Macro%20VBA%20assistance.%20I%20am%20created%20an%20auto-populating%20inventory%20Excel%20workbook.%20I'm%20stuck%20on%20my%20current%20step%3A%20automatically%20adding%20rows%20to%20a%20table.%20I%20created%20an%20ActiveX%20command%20button%20that%20I%20hope%20will%20take%20a%20numerical%20value%20entered%20in%20a%20cell%20on%20that%20same%20sheet%20and%20copy%2Fpaste%20row%201%20of%20a%20table%20on%20another%20sheet.%20The%20first%20row%20of%20that%20table%20has%20formulas%20that%20pull%20data%20from%20another%20sheet%2C%20so%20I%20don't%20want%20to%20just%20insert%20rows.%20To%20summarize%20what%20I%20hope%20happens%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20Enter%20number%20in%20cell%20(Sheet2%3AD20)%20-%20value%20%22X%22%3C%2FP%3E%3CP%3E2.%20Click%20command%26nbsp%3B%20button%20%3D%20(Sheet1%3ATable%3ARow1)%20-%26nbsp%3B%3CSTRONG%3Enot%26nbsp%3B%3C%2FSTRONG%3Eheader%20row%20-%20(Sheet1%3AA3%3AK3)%20is%20copied%20and%20pasted%2C%20starting%20in%20position%20(Table%3ARow2)%2C%20%22X%22%20minus%201%2C%20as%20part%20of%20that%20table.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERow1%20is%20part%20of%20the%20inventory%2C%20so%20minus%201%20is%20optional%20until%20I%20get%20this%20figured%20out...%20but%20it%20would%20be%20nice%20to%20have.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20also%20open%20to%20other%20suggestions%20for%20other%20options%20to%20accomplish%20the%20solution%20(enter%20a%20number%2C%20click%20a%20button%2C%20and%20the%20complete%20table%20on%20Sheet1%20is%20created).%20I%20have%20searched%20a%20lot%2C%20but%20I%20haven't%20found%20VBA%20scripting%20for%20exactly%20what%20I%20am%20looking%20for.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1766219%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Visitor

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