PDA

View Full Version : Macro for copying specific values from one excel file to another



TrueTears
09-02-2013, 07:46 AM
I have attached my workbook (Data_CIMDO_Sub_SovBank).

What I wish to do is the following steps: I have attached another workbook (Book1) here (https://www.dropbox.com/s/bf16cpi6532ze1j/Book1.xlsx) which illustrates what I want to achieve in the following steps.

1. In the workbook Data_CIMDO_Sub_SovBank there are 3 sheets, PD, COV and DT. First, in the PD sheet, I select the row beginning with "AUT5" and copy only the values in that row into Book1 (open Book1 -> PD worksheet to see what I mean). Then back to the workbook Data_CIMDO_Sub_SovBank, I select the row beginning with "EBG5" and again copy only the values in that row into Book1.

2. In the COV sheet of Data_CIMDO_Sub_SovBank, I want to select a 2 by 2 matrix which is defined by the names of the rows I selected in step 1, that is, I want a 2x2 matrix formed by the following values (AUT5, AUT5) = cell B2, (EBG5, AUT5) = cell B12, (EBG5,EBG5) = cell L12 and (AUT5, EBG5) = cell L2. I then want to copy this matrix into Book1 (open Book1 -> COV worksheet to see what I mean).

3. Finally in the DT sheet of Data_CIMDO_Sub_SovBank, I want to select the value next to AUT5 and copy into Book1 (open Book1 -> DT worksheet to see what I mean). Similarly, I also want to copy the value next to EBG5 in Data_CIMDO_Sub_SovBank into Book1.

Now I want to repeat steps 1 to 3 with AUT5 fixed but cycle through EBG5, RBI5, DEX5, ..., until ESFG5 and I want each cycle to be done in a new workbook. For example, Book1 is for AUT5/EGB5, Book2 will be for AUT5/RBI5, ... until Book24 will be for AUT5/ESFG5.

Thanks so much, I have no idea how to code this up, please let me know if you want me to explain what I mean further.