Macro to copy the data from excel file containing name "_res_av_" in folders and subfolders, copy the required data and paste in another excel file

Swaroop Kavi

New Member
Joined
Aug 25, 2021
Messages
4
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello,
I am looking for a vba code to find an excel file containing file name "_res_av_" in folders and subfolders, open it, copy the content from A1:E10000, paste in another required excel file from A7 to E70007; G7 to K70007 etc. Note that there has to be an empty column between the set of data copied (For example, Column F, L etc., in this case). Also, Copy the excel file names into B2, H2, N2 etc cells.
Thank you
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
You can use the same method as I showed you before

VBA Code:
Sub JEC()
   Application.ScreenUpdating = False
   jv = Split(CreateObject("wscript.shell").exec("cmd /c Dir ""C:\Users\xxx\Downloads\*_res_av_*"" /b/s").stdout.readall, vbCrLf)

   For Each it In jv
      If Len(it) Then
         With Workbooks.Open(it).Sheets(1)           
             your code.......

            .Parent.Close
         End With
      End If
   Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

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