PDA

View Full Version : Solved: Copying rows with formulas from 1 sheet to another



ash.ali
11-24-2006, 10:09 AM
:dunno Help needed. I am an excel user but don't know much about functions or VBA. I have a wkbk with 2 sheets and a further 2 sheets which are the templates.
I have a button for adding new rows and basically when you click a row from the first template is copied and pasted into the corresponding sheet then a row from the second template is copied and pasted into the second corresponding sheet. In the second sheet the functions are not looking at the correct fields in the first sheet, to retrieve relevant data from the first sheet. Any help would be appreciated. Sample file attached. Thanks

CBrine
11-24-2006, 11:48 AM
Ash,
I took a look at your code, and I'm pretty sure you are macro recording. It gave me a good idea what you are looking for, so I revamped the entire thing. I changed your forms button to an ActiveX control, removed the module and placed the code at the buton_click event of the control, and rewrote the code.
Since you are copying 10 rows on one workbook, then 2 on the other your linked formula in the 2 row sheet was only incrementing by 2 cells instead of the 10 cells needed. I added the logic required into the code so that your formula's are reflective of what I think you are looking for.

HTH
Cal

ash.ali
11-26-2006, 04:49 AM
It works great. Thank you for your help. I will study the code and see what I can learn as my end file will have more rows in one sheet than the other. Thanks again.:thumb