Import data from 2 CSV files into the same worksheet

richard_a

New Member
Joined
Jan 22, 2013
Messages
23
Hi guys,

I'm looking for some help writing a macro to import CSV data into a master sheet (called individual load). I'll describe as best I can how I would like it to work. Copies of the documents can be found and downloaded from the link at the bottom of the post.

The data is from 34 participants in an exercise study. Each day they complete a certain amount of exercise which is quantified using 6 variables (DUR,TD,HID,SPR,HR,PL) which are recorded daily and updated into a weekly sheet (Week 1, Week 2, Week 3.....Week 52, as available at the link below). The weekly sheets are all of the exact same layout. What I would like to do is have a macro to import selected variables from the weekly sheets into the individual load sheet, which is used as a longitudinal record of all the parameters.

The example "individual load" sheet I have included shows the longitudinal layout for the TD and HID parameters. So for example, the TD values from Monday in week 1 (D20:D53) need to be imported to I11:I44. The HID values in week 1 (E20:E53) need to be imported to I51:I84. Each subsequent parameter (SPR, HR, PL [DUR does not need to be imported]) would need to be imported into the correct day but underneath TD and HID.

Week 2 data for each parameter would need to be imported into the week 2 ranges in the individual load sheet (column P to V). The current import macro on the sheet requires that all data must be reimported each time data is updated. So for example, when wanting to add Week 35's data, all 35 weekly CSV files must be selected so that the values occupy the correct spaces. I don't have a problem with having to do this but if there was an option where only the CSV file of interest had to be imported that would be great.

Also of note, I may be changing the number of parameters from 6 to 8, so an easy to edit code would be great to allow me to make changes and accomodate extra parameters. Any help or advice would be hugely appreciated. I'm using Excel 2010.

Thanks

Richard



https://drive.google.com/folderview?id=0B62oOa7h0BprMDFhYjdQbFJRbUE&usp=sharing
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,223,909
Messages
6,175,314
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top