Macro to locate and copy data from other workbooks, on a specific worksheet and row based on a value

thunt

New Member
Joined
Aug 14, 2013
Messages
24
Hello and good Friday,

I am using Windows 7 and Excel 2010.

I am in need of a macro that can pull a row of data (based on a value in a column), from a specific worksheet (in every workbook in a specified location), and insert that row of data in to a workbook on a new row, and then do the same thing on the row below. Also if I rerun the macro it clears all the current data and gets the latest. so i will try to break it out in detail below...

---------------------------------------------------------

1.
I am looking for a way to have a Workbook that is named “Summary” (located in "C:\partsandlabor"), pull data from all workbooks in a specified location ("C:\partsandlabor\allparts”).
The "Summary" workbook would be doing the macro on the worksheet named "All Items". Below is a example of what it would look like before running the macro for the first time:

"Summary" Workbook, "All Items" Worksheet Sample
ABCDEFG
1
2ItemStoreDateTimeDescriptionPriceLocation
3
4
5
6


<tbody>
</tbody>


2.
The data that needs to be pulled in each of the workbooks in "C:\partsandlabor\allparts" is on a worksheet named “Change Log” (other worksheets exist but only “Change Log” is needed). Within "Change Log", there are rows/columns of data. I need the macro to find the row in column "A" that has "Active" in it, and copy that data from that row from column B:H and bring it over to the first empty row in workbook "Summary" on worksheet "All Items". (So for the example below it would be be copying row 4 that, as that is the row that "Active" is currently typed in)

(First workbook opened in specified location), "Change Log" Worksheet Sample
ABCDEFGH
1
2BroadcastItemStoreDateTimeDescriptionPriceLocation
3DollKolhser Bear
12/25/1412:00Stuff$0.10North Pole
4ActiveDollTarget Range11/13/141:45That Stuff$0.13Michigan
5DollSears Our Us7/4/142:30This Stuff$500.34California
6DollWally World11/25/144:20Other Stuff$4.20Georgia

<tbody>
</tbody>


3.
After the macro ran on the first workbook it found in "C:\partsandlabor\allparts”, it would paste/insert it in the "Summary" workbook, "All Items" worksheet like below.

"Summary" Workbook, "All Items" Worksheet Sample: After running once on only one workbook in "C:\partsandlabor\allparts”
ABCDEFG
1
2ItemStoreDateTimeDescriptionPriceLocation
3DollTarget Range11/13/141:45That Stuff$0.13Michigan
4
5
6


<tbody>
</tbody>

4.
If there were other excel files in "C:\partsandlabor\allparts”, it would do the same as Step 2, but would paste/insert the data on the next available row in the "Summary" workbook, on "All Items" Worksheet (row 4 in this scenario), until it had ran through every workbook in "C:\partsandlabor\allparts”.

5.
I also need the macro so if I run it a second time/again (to update the "All Items" worksheet) it would delete all the current data from A3:G3 and down, and rerun Step2-Step4 to update (in case Active was moved do a different row in one of the workbooks in "C:\partsandlabor\allparts”.


I hope that makes sense, I tried to step through what I am trying to accomplish. Please let me know if you need me to clarify anything more or confused by it.

Thanks in advance.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,215,250
Messages
6,123,887
Members
449,131
Latest member
leobueno

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