Morning everybody, I'm trying to crete a code for a specific action, but no idea on how to start.
I have a folder with different contracts in excel files: contract1.xlsm, mickeymouse.xlsm, goofy.xlsm, contract2.xlsm, etc. The contracts have two different formats: one with a range of 40 rows and another one with a range of 50 rows.
I created, in a new file, two different templates, one of 40 rows and one of 50 rows.
So i should have the macro reading all the contracts in the folder (can be more than hundred), count the number of rows in the file and copy the correct template on a spreadsheet.
Ex. Contract nr. 1 (contract1.xlsm) has 40 rows, so the macro will copy the template of 40 rows (from the sheet template40) and will paste it starting from cell A1 of the sheet "Contracts".
Contract nr. 2 (mickeymouse.xlsm) has 50 rows, so the macro will copy the template of 50 rows (from the sheet "template50") and will paste it starting from the cell A43 (40 rows of the first contract plus two blank row).
Contract nr. 3 (goofy.xlsm) has again 40 rows, so the macro will copy the template of 40 rows (from the sheet "template40") and will paste it starting from cell A96 (40 rows of the first contract, plus two blank rows, plus 50 rows of the second contract, plus two blank rows).
and so on...
is it something that can be done with one single macro.
i've tried, but no results...
thanks in advance for your coop.
marco
I have a folder with different contracts in excel files: contract1.xlsm, mickeymouse.xlsm, goofy.xlsm, contract2.xlsm, etc. The contracts have two different formats: one with a range of 40 rows and another one with a range of 50 rows.
I created, in a new file, two different templates, one of 40 rows and one of 50 rows.
So i should have the macro reading all the contracts in the folder (can be more than hundred), count the number of rows in the file and copy the correct template on a spreadsheet.
Ex. Contract nr. 1 (contract1.xlsm) has 40 rows, so the macro will copy the template of 40 rows (from the sheet template40) and will paste it starting from cell A1 of the sheet "Contracts".
Contract nr. 2 (mickeymouse.xlsm) has 50 rows, so the macro will copy the template of 50 rows (from the sheet "template50") and will paste it starting from the cell A43 (40 rows of the first contract plus two blank row).
Contract nr. 3 (goofy.xlsm) has again 40 rows, so the macro will copy the template of 40 rows (from the sheet "template40") and will paste it starting from cell A96 (40 rows of the first contract, plus two blank rows, plus 50 rows of the second contract, plus two blank rows).
and so on...
is it something that can be done with one single macro.
i've tried, but no results...
thanks in advance for your coop.
marco