Pull & Paste files from folder loop

xcelnovice

Board Regular
Joined
Dec 31, 2011
Messages
81
Hi, in the code below I am grabbing a workbook from a folder and pasting it to the target wb. It works right now, what I'd like to know is how can i go about having it pull other workbooks and pasting into the target wb. So after the macro pulls the first wb(JH A MIP COPY) & pastes it into the target, I'd like it to cycle through the same folder that JH A MIP is in and find the other wb's in that folder and paste them to seperate tabs. Hope this makes sense.


Sub CostMgmtUpdate() 'Name of my program

Dim wbTarget As Workbook 'Cost Management report where data will be pasted
Dim wbSource As Workbook 'BTD File where data is pulled from
'Open both workbooks
Set wbTarget = Workbooks.Open("C:\xxxxx\xxxxx\Desktop\JH CLIN 0005 November 2015 SLIN Budget (CMS ART) vs Actuals (Costpoint)-COPY.xlsm")
Set wbSource = Workbooks.Open("C:\xxxxx\xxxxx\Desktop\JH A MIP-COPY.xlsx")
'Activate Summary sheet & find = & replace with #
wbTarget.Sheets("Summary").Cells.Replace What:="=", Replacement:="#", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
'Now transfer data from source to target
wbSource.Sheets("JH A MIP-COPY").Range("A:H").Copy
wbTarget.Sheets("AB").Range("A1").PasteSpecial
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,217,408
Messages
6,136,436
Members
450,011
Latest member
faviles5566

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